Wide Studio Object Reference

| Wide Studio Object Reference |
Wide Studio Home
Up to
  ## Class Name WSCstring ## Specification of methods ### WSCstring Function Description Form WSCstring() Function String class constructor Creates a string class instance Description Parameters None. Return value A pointer to a string class instance Notice Samples
        WSCstring str;
        str = "STRINGS";
        printf("str=%s\n",(char*)str);
  ### WSCstring Function Description Form WSCstring(char* str,long encoding = WS_EN_DEFAULT) Function String class constructor Description Specify strings and their encoding Parameters
  (in)char* str | Strings
  (in)long encoding | String encoding

The following values are supported for encoding. Default is WS_EN_DEFAULT

Encoding | Meaning
WS_EN_DEFAULT | Specify current settings (Default value)
WS_EN_LOCALE | Specify current LANG environment setting
WS_EN_NONE | Specify none
WS_EN_ISO8859_1 | Specify ISO8859(1)
WS_EN_ISO8859_2 | Specify ISO8859(2)
WS_EN_ISO8859_3 | Specify ISO8859(3)
WS_EN_ISO8859_4 | Specify ISO8859(4)
WS_EN_ISO8859_5 | Specify ISO8859(5)
WS_EN_ISO8859_6 | Specify ISO8859(6)
WS_EN_ISO8859_7 | Specify ISO8859(7)
WS_EN_ISO8859_8 | Specify ISO8859(8)
WS_EN_ISO8859_9 | Specify ISO8859(9)
WS_EN_ISO8859_10 | Specify ISO8859(10)
WS_EN_ISO8859_11 | Specify ISO8859(11)
WS_EN_ISO8859_12 | Specify ISO8859(12)
WS_EN_ISO8859_13 | Specify ISO8859(13)
WS_EN_ISO8859_14 | Specify ISO8859(14)
WS_EN_ISO8859_15 | Specify ISO8859(15)
WS_EN_UTF8 | Specify UTF8
WS_EN_KOI8R | Specify KOI8R
WS_EN_EUCJP | Specify EUCJP
WS_EN_SJIS | Specify SJIS
WS_EN_EUCKR | Specify EUCKR
WS_EN_EUCCN | Specify EUCCN
WS_EN_BIG5 | Specify BIG5

Return value
  A pointer to a string class instance
Notice
Samples

        //When set EUCJP code into strings
        WSCstring str("STRING",WS_EN_NONE);
        printf("str=%s\n",(char*)str);

  ### WSCstring Function Description

  Form
    WSCstring(WSCstring& str)
  Function
    String class copy constructor Create a string class instance
  Description
  Parameters

    (in)WSCstring& str | String instance

  Return value
    A pointer to a string class instance
  Notice
  Samples

          WSCstring str("STRING");
          WSCstring str2 = str;
          printf("str2=%s\n",(char*)str2);

  ### setString Function Description

  Form
    void setString(char* str,long encode = WS_EN_DEFAULT)
  Function
    Set strings
  Description
  Parameters

    (in)char* str | Strings
    (in)long encoding | Encoding

    When it is omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    None.
  Notice
  Samples

          WSCstring str;
          str.setString("STRINGS",WS_EN_NONE);
          printf("str=%s\n",(char*)str);

  ### getString Function Description

  Form
    char* getString(long encode = WS_EN_DEFAULT)
  Function
    Obtain strings
  Description
  Parameters

    (in)long encoding | Encoding

    When it is omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    Specified encoding strings
  Notice
  Samples

          WSCstring str;
          str.setString("STRING",WS_EN_NONE);
          printf("str=%s\n",str.getString());

  ### getChars Function Description

  Form
    long getChars()
  Function
    Obtain the number of character strings currently set
  Description
  Parameters
    None.
  Return value
    The number of character strings
  Notice
  Samples

          WSCstring str;
          str.setString("STRINGS",WS_EN_NONE);
          printf("str=%d\n",str.getChars()); //Returns 7

  ### getEncoding Function Description

  Form
    long getEncoding()
  Function
    Obtain encoding that currently set
  Description
  Parameters
    None.
  Return value
    Encoding
    Please refer to WSCstring(char*,long) for kinds of encoding that will return
  Samples

          WSCstring str;
          str.setString("STRINGS",WS_EN_EUCJP);
          printf("encoding=%d\n",str.getEncoding()); //Returns WS_EN_EUCJP = 20

  Notice

  ### isExist Function Description

  Form
    long isExist(char* str,long encoding = WS_EN_DEFAULT)
  Function
    Search for strings
  Description
  Parameters

    (in)char* str | Strings
    (in)long encoding | Encoding

    When omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    Position counted on characters. -1 is returned when it does not exist.
  Notice
  Samples

          if (str.isExist("STRING") == -1){
            //When "STRING" does not exist
          }else{
            //When "STRING" exist
          }

  ### addString Function Description

  Form
    void addString(const WSCstring& str)
  Function
    Add strings
  Description
  Parameters

    (in)WSCstring& str | Strings

  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS");
          WSCstring str2("ADD");
          str.addString(str2);
          printf("str=%s\n",(char*)str); //returns "STRINGSADD"

  ### addString Function Description

  Form
    void addString(const WSCvariant& str,long encoding=WS_EN_DEFAULT)
  Function
    Add strings
  Description
  Parameters

    (in)WSCvariant& str | Strings
    (in)long encoding | Encoding

    When it is omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS",WS_EN_EUCJP);
          WSCvariant val;
          val = "ADD";
          str.addString(val,WS_EN_EUCJP);
          printf("str=%s\n",(char*)str); //returns "STRINGSADD"

  ### addString Function Description

  Form
    void addString(char* str,long encoding=WS_EN_DEFAULT)
  Function
    Add strings
  Description
  Parameters

    (in)cha* str | Strings
    (in)long encoding | Encoding

    When it is omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS",WS_EN_EUCJP);
          str.addString("ADD",WS_EN_EUCJP);
          printf("str=%s\n",(char*)str); //Displays "STRINGSADD"

  ### cutString Function Description

  Form
    void cutString(WSCulong pos);
  Function
    Delete strings from the position of the specified character.
  Description
  Parameters

    (in)WSCulong pos | Position of character to delete with the top setting 0

    When 0 is specified, whole strings are deleted
  Return value
    None.
  Notice
  Samples

          WSCstring str("STRING",WS_EN_EUCJP);
          str.cutString(2);
          printf("str=%s\n",(char*)str); //Display "STRING"

  ### insertString Function Description

  Form
    void insertString(WSCulong pos,WSCstring& str);
  Function
    Insert strings at a specified character position
  Description
  Parameters

    (in)WSCulong pos | Position to insert strings specified by counting from the top as 0
    (in)WSCstring& str | Strings

  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS",WS_EN_EUCJP);
          WSCstring str2("INSERT",WS_EN_EUCJP);
          str.insertString(0,str2);
          printf("str=%s\n",(char*)str); //Display "INSERTSTRINGS"

  ### deleteChar Function Description

  Form
    void deleteChar(WSCulong pos)
  Function
    Delete one character at a spacified character position.
  Description
  Parameters

    (in)WSCulong pos | Position to delete a character specified by counting from the top as 0

  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS",WS_EN_NONE);
          str.deleteChar(6);
          printf("str=%s\n",(char*)str); //Display "STRING"

  ### deleteChars Function Description

  Form
    void deleteChars(WSCulong pos,WSCulong len)
  Function
    Delete strings at a specified character position
  Description
  Parameters

    (in)WSCulong pos | Position to insert strings specified by counting from the top as 0
    (in)WSCulong len | The number of characters to delete

  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS",WS_EN_NONE);
          str.deleteChars(0,2);
          printf("str=%s\n",(char*)str); //Display "RINGS"

  ### clear Function Description

  Form
    void clear()
  Function
    Clear strings
  Description
  Parameters
    None.
  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS",WS_EN_EUCJP);
          //When clearing set strings, do the following:
          str.clear();

  ### delLineFeed Function Description

  Form
    void delLineFeed()
  Function
    Delete linefeed characters in strings
  Description
  Parameters
    None.
  Return value
    None.
  Notice
  Samples

          WSCstring str("STRINGS\nNEWLINE",WS_EN_NONE);
          str.delLineFeed();
          printf("str=%s\n",(char*)str); //Display "STRINGSNEWLINE"

  ### delString Function Description

  Form
    void delString(char* str,lon num,long encoding = WS_EN_DEFAULT)
  Function
    Search for and delete the specified number of strings from specified strings. When 0 is specified as the number of deletion, it deletes all matching characters
  Description
  Parameters

    (in)char* str | Strings to delete
    (in)long num | The number of characters to delete
    (in)long encoding | Encoding

    When omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    None.
  Notice
  Samples

          WSCstring str("STRING1STRING2STRING",WS_EN_NONE);
          str.deleteString("STRING",1,WS_EN_NONE);
          printf("str=%s\n",(char*)str); //Display "1STRING2STRING"
          str.deleteString("STRING",0,WS_EN_EUCJP);
          printf("str=%s\n",(char*)str); //Display "12"

  ### delHeadSpace Function Description

  Form
    void delHeadSpace();
  Function
    Delete halfsize spaces located at the top of strings
  Description
  Parameters
    None.
  Return value
    None.
  Notice
  Samples

          WSCstring str("   STRINGS",WS_EN_EUCJP);
          str.delHeadSpace();
          printf("str=%s\n",(char*)str); //Display "STRINGS"

  ### to_upper Function Description

  Form
    void to_upper();
  Function
    Convert alphabet characters to upper-case characters
  Description
  Parameters
    None.
  Return value
    None.
  Notice
  Samples

          WSCstring str("abcABC");
          str.to_upper();
          printf("str=%s\n",(char*)str); //Display "ABCABC"

  ### to_lower Function Description

  Form
    void to_lower();
  Function
    Convert alphabet characters to lower-case characters
  Description
  Parameters
    None.
  Return value
    None.
  Notice
  Samples

          WSCstring str("abcABC");
          str.to_lower();
          printf("str=%s\n",(char*)str); //Display "abcabc"

  ### replaceString Function Description

  Form
    long replaceString(char* src,char* dest,long num,long encoding= WS_EN_DEFAULT)
  Function
    Replace specified strings.
  Description
    Replace specified strings, src with dest Replace the number of strings specified by num When num is 0, all matched strings are replaced
  Parameters

    (in)char* src | Replacing strings
    (in)char* dest | Replaced strings
    (in)long num | The number of strings to replace
    (in)long encoding | String encoding

    When omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    The number of strings replaced
  Notice
  Samples

          WSCstring str("abcabcabc");
          str.replaceString("abc","123",1);
          printf("str=%s\n",(char*)str); //Display "123abcabc"
          str.replaceString("abc","123",0);
          printf("str=%s\n",(char*)str); //Display "123123123"

  ### getWords Function Description

  Form
    long getWords(char* sep,long encoding = WS_EN_DEFAULT)
  Function
    Obtain the number of words using sep as a separator Obtain the number of words using a whitespace as a separator when sep and encoding are omitted.
  Description
  Parameters

    (in)char* sep | Separator
    (in)long encoding | String encoding

    When omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    The number of words
  Notice
  Samples

          WSCstring str("ABC,abc,123");
          long words = str.getWords(","); //3 is returned
          long i;
          for(i=0; i < words; i++){
            WSCstring word = str.getWord(i,",");
            long wordpos = str.getWordPos(i,",");
            printf("word%d=%s\n",i,(char*)word); //Display "ABC","abc", and "123" with this order.
            printf("   pos=%d\n",wordpos); //Display positions of "ABC", "abc", and "123"
          }

  ### getWordCharPos Function Description

  Form
    long getWordCharPos(long no,char* sep,long encoding = WS_EN_DEFAULT)
  Function
    Obtain a position of characters of no-th words with sep as a separator regarding the top as 0 Obtain a position of words with a whitespace as its separator when sep and encoding are omitted
  Description
  Parameters

    (in)long no | The number of words (0,1,2,...)
    (in)char* sep | Separator
    (in)long encoding | String encoding

    When omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    A position of words specified
  Notice
  Samples
    Refer to getWords()

  ### getWord Function Description

  Form
    WSCstring getWord(long no,char* sep,long encoding = WS_EN_DEFAULT)
  Function
    Obtain a no-th word with a specified separator couting the top 0 Obtain a word with a whitespace as a separator when sep and encoding are omitted.
  Description
  Parameters

    (in)long no | The number of words (0,1,2,...)
    (in)char* sep | Separator
    (in)long encoding | String encoding

    When omitted, encoding is set to WS_EN_DEFAULT. Please refer to WSCstring(char*,long) for available encodings
  Return value
    Specified word
  Notice
  Samples
    Refer to getWords()

  ### getLines Function Description

  Form
    long getLines()
  Function
    Obtain the number of lines
  Description
  Parameters
    None.
  Return value
    the number of lines
  Notice
  Samples

          WSCstring str("abc\nabc\nabc");
          long lines = str.getLines(); //3 is returned

  ### = Description of operators

  Form
    WSCstring& operator = (const WSCstring& str);
  Function
    Substitution operator
  Description
  Parameters

    (in)WSCstring& str | Strings to substitute

  Return value
    Copied strings
  Notice
  Samples

          WSCstring str;
          WSCstring str2("abc");
          str = str2;

  ### = Description of operators

  Form
    WSCstring& operator = (char* str);
  Function
    Substitution operator
  Description
  Parameters

    (in)char* str | Strings to substitute

  Return value
    Copied strings
  Notice
  Samples

          WSCstring str;
          str = "abc"; //Substitute

  ### = Description of operators

  Form
    WSCstring& operator = (const WSCvariant& str);
  Function
    Substitution operator
  Description
  Parameters

    (in)WSCvariant& str | Data to substitute

  Return value
    Copied strings
  Notice
  Samples

          WSCvariant str("abc");
          WSCstring str2;
          str2 = str; //Substitute WSCvarinat

  ### += Description of operators

  Form
    WSCstring& operator += (const WSCstring& str);
  Function
    String-concatenating operator
  Description
  Parameters

    (in)WSCstring& str | Strings to concatenate

  Return value
    Concatenated strings
  Notice
  Samples

          WSCstring str("abc");
          WSCstring str2("ABC");
          str += str2;
          printf("str=%s\n",(char*)str); //"abcABC" is displayed

  ### += Description of operators

  Form
    WSCstring& operator += (char* str);
  Function
    String-concatenating operator
  Description
  Parameters

    (in)char* str | Strings to concatenate

  Return value
    Concatenated strings
  Notice
  Samples

          WSCstring str("abc");
          char* str2 = "ABC";
          str += str2;
          printf("str=%s\n",(char*)str); //"abcABC" is returned

  ### += Description of operators

  Form
    WSCstring& operator += (const WSCvariant& str);
  Function
    String-concatenating operator
  Description
  Parameters

    (in)WSCvariant& str | Data to concatenate

  Return value
    Concatenated strings
  Notice
  Samples

          WSCstring str("abc");
          WSCvariant str2;
          str2 = "ABC";
          str += str2;
          printf("str=%s\n",(char*)str); //"abcABC" is returned

  ### << Description of operators

  Form
    WSCstring& operator << (const WSCstring& str);
  Function
    String-concatenating operator
  Description
  Parameters

    (in)WSCstring& str | Strings to concatenate

  Return value
    Concatenated strings
  Notice
  Samples

          WSCstring str("abc");
          WSCstring str2("ABC");
          str << str2;
          printf("str=%s\n",(char*)str); //"abcABC" is displayed

  ### << Description of operators

  Form
    WSCstring& operator << (char* str);
  Function
    String-concatenating operator
  Description
  Parameters

    (in)char* str | Strings to concatenate

  Return value
    Concatenated strings
  Notice
  Samples

          WSCstring str("abc");
          char* str2 = "ABC";
          str << str2;
          printf("str=%s\n",(char*)str); //"abcABC" is displayed

  ### << Description of operators

  Form
    WSCstring& operator << (const WSCvariant& str);
  Function
    String-concatenating operator
  Description
  Parameters

    (in)WSCvariant& str | Data to concatenate

  Return value
    Concatenated strings
  Notice
  Samples

          WSCstring str("abc");
          WSCvariant str2;
          str2 = "ABC";
          str << str2;
          printf("str=%s\n",(char*)str); //"abcABC" is displayed

  ### + Description of operators

  Form
    WSCstring& operator + (const WSCstring& str);
  Function
    String-combining operator
  Description
  Parameters

    (in)WSCstring& str | Strings to combine

  Return value
    Combined strings
  Notice
  Samples

          WSCstring str("abc");
          WSCstring str2("ABC");
          WSCstring str3;
          str3 = str + str2;
          printf("str3=%s\n",(char*)str3); //"abcABC" is displayed

  ### + Description of operators

  Form
    WSCstring& operator + (char* str);
  Function
    appends the specified string to the string.
  Description
  Parameters

    (in)char* str | Strings to combine

  Return value
    Combined strings
  Notice
  Samples

          WSCstring str("abc");
          char*  str2 = "ABC";
          WSCstring str3;
          str3 = str + str2;
          printf("str3=%s\n",(char*)str3); //"abcABC" is displayed

  ### + Description of operators

  Form
    WSCstring& operator + (const WSCvariant& str);
  Function
    String-combining operator
  Description
  Parameters

    (in)WSCvariant& str | Data to combine

  Return value
    Strings to combine
  Notice
  Samples

          WSCstring str("abc");
          WSCvariant str2;
          str2 = "ABC";
          WSCstring str3;
          str3 = str + str2;
          printf("str3=%s\n",(char*)str3); //"abcABC" is displayed

  Document Release 3.20
  For use with Wide Studio Release 3.20, Spring 2003

  Wide Studio Home | Up to

  Copyright(C) T. Hirabayashi, 1999-2003 |  | Last modified: February 3, 2003