WSTestUTF32String()
This feature is not supported on the Wolfram Cloud.

int WSTestUTF32String(WSLINK l, const unsigned int *s, int n)
tests that the next expression to be read from l is a string with the value s, a UTF-32 encoded string of length n.

DetailsDetails

  • WSTestUTF32String() fails if the current object on the link is not a string, or if the value of the string does not match s.
  • WSTestUTF32String() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use WSError() to retrieve the error code if WSTestUTF32String() fails.
  • WSTestUTF32String() will reset the stream pointer to the expression on the link just prior to calling WSTestUTF32String()if the function fails. This operation behaves as if the programmer called WSCreateMark(link); WSTestUTF32String(); WSSeekToMark().
  • The UTF-32 encoded string s must include a byte order mark.
  • The length n of the UTF-32 string s must include the byte order mark.
  • WSTestUTF32String() is declared in the WSTP header file wstp.h.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

#include "wstp.h"

/* A function for testing the next expression on the link for a string */

void f(WSINK l)
{
    const unsigned int theString[9];

    theString[0] = 0xFEFF;
    theString[1] = '$'
    theString[2] = 'V';
    theString[3] = 'e';
    theString[4] = 'r';
    theString[5] = 's';
    theString[6] = 'i';
    theString[7] = 'o';
    theString[8] = 'n';

    if(! WSTestUTF32String(l, (const unsigned int *)theString,
        9))
    { /* The next expression on the link is not $Version */ }
    else
    { /* The next expression on the link is $Version */ }
}
Introduced in 2014
(10.0)