index of namespace default
 
 index of project core
 
 index of module core

Class core.String


SynopsisA buffered String class that can handle ASCII character sequences.

  Base classes:
  Methods:
See also:  



Method abbrev
This method supports the => operator.
Signature
abbrev(intlength)
 :String
Arguments
intlength
Returns
String

 
 top of page
Method alloc
Signature
alloc(intbufSize)
Arguments
intbufSize

 
 top of page
Method append
This method supports the => operator.
Signature
append(Strings)
 :String
Arguments
Strings
Returns
String

 
 top of page
Method appendRepeat
Append the given String 'numRepeats' times.
Signature
appendRepeat(Strings,
  intnumRepeats 
  )  
Arguments
Strings
intnumRepeats
Description

Does nothing when 's' is empty or numRepeats is <= 0.
This method supports the => operator.

 
 top of page
Method charsetBlacklist
Remove all chars present in 'charset'.
Signature
charsetBlacklist(Stringcharset)
Arguments
Stringcharset

 
 top of page
Method charsetIndexOf
Signature
charsetIndexOf(Stringcharset,
  intoff 
  )  
 :int
Arguments
Stringcharset
intoff
Returns
int

 
 top of page
Method charsetIndexOfWordEnd
Signature
charsetIndexOfWordEnd(Stringcharset,
  intoff 
  )  
 :int
Arguments
Stringcharset
intoff
Returns
int

 
 top of page
Method charsetIndexOfWordStart
Signature
charsetIndexOfWordStart(Stringcharset,
  intoff 
  )  
 :int
Arguments
Stringcharset
intoff
Returns
int

 
 top of page
Method charsetWhitelist
Keep all chars present in 'charset'.
Signature
charsetWhitelist(Stringcharset)
Arguments
Stringcharset

 
 top of page
Method checkConversions
Check available type conversions
Signature
checkConversions():int
Returns
intYAC_TYPE_INT if string can be converted to int (dec/hex), or YAC_TYPE_FLOAT, or YAC_TYPE_OBJECT (arbitrary string)

 
 top of page
Method checkFloatConversion
Check if string is a float
Signature
checkFloatConversion():boolean
Returns
booleantrue if string can be converted to float

 
 top of page
Method checkIntConversion
Check if string is an integer
Signature
checkIntConversion():boolean
Returns
booleantrue if string can be converted to integer

 
 top of page
Method compare
Signature
compare(Strings)
 :boolean
Arguments
Strings
Returns
boolean

 
 top of page
Method compareIgnoreCase
Signature
compareIgnoreCase(Strings)
 :boolean
Arguments
Strings
Returns
boolean

 
 top of page
Method compareIgnoreWhitespace
Signature
compareIgnoreWhitespace(Strings)
 :boolean
Arguments
Strings
Returns
boolean

 
 top of page
Method copy
Signature
copy(Objecto)
Arguments
Objecto

 
 top of page
Method cp1252ToUTF8
Convert CP1252 extended ASCII string to UTF-8
Signature
cp1252ToUTF8(booleanbBOM)
Arguments
booleanbBOM
Description

(note) CP1252 is the HTML5 default encoding for text labeled as ISO8859-1

 
 top of page
Method deleteRegion
This method supports the => operator.
Signature
deleteRegion(intoff,
  intlen 
  )  
 :String
Arguments
intoff
intlen
Returns
String

 
 top of page
Method empty
Signature
empty()

 
 top of page
Method endsWith
Signature
endsWith(Strings)
 :boolean
Arguments
Strings
Returns
boolean

 
 top of page
Method escapeControlChars
Replace control characters and "' by escape sequences
Signature
escapeControlChars()

 
 top of page
Method fixLength
Signature
fixLength()

 
 top of page
Method free
Signature
free()

See also:  


 
 top of page
Method freeStack
Signature
freeStack()

 
 top of page
Method getc
Signature
getc(intoffset)
 :char
Arguments
intoffset
Returns
char

 
 top of page
Method getChecksum
Return checksum for the given String.
Signature
getChecksum():int
Returns
int32bit string checksum

 
 top of page
Method getChecksumIgnoreWhitespace
Return checksum for the given String, ignoring all white space (< 32) characters.
Signature
getChecksumIgnoreWhitespace():int
Returns
int32bit string checksum

 
 top of page
Method getDebugString
Signature
getDebugString():String
Returns
String

 
 top of page
Method getDirName
Return directory part of file.
Signature
getDirName():String
Returns
StringDirectory name (including trailing forward/backward slash resp. drive letter)
Description

This method supports the => operator.

 
 top of page
Method getLength
Return number of chars, including ASCIIZ.
Signature
getLength():int
Returns
int

 
 top of page
Method getMetaFlags
Get string meta flags (e.g. whether String was originally enclosed in \"\", TKS_STRFL_QUOT)
Signature
getMetaFlags():int
Returns
intflags

 
 top of page
Method getNumChars
Return number of chars, excluding ASCIIZ.
Signature
getNumChars():int
Returns
int

 
 top of page
Method getQuotFlag
Get quotation flag.
Signature
getQuotFlag():int
Returns
intflag 1 when String was wrapped in \"\", 2 when String was wrapped in \'\'.

 
 top of page
Method getWord
Deprecated:  Use splitSpace()splitChar()splitCharset()tokenize() instead
Signature
getWord(intwordNr)
 :String
Arguments
intwordNr
Returns
String

 
 top of page
Method hasUTFBOM
Check if string starts with UTF-8 byte order mark (U+FEFF encoded as 0xEF 0xBB 0xBF)
Signature
hasUTFBOM():boolean
Returns
booleanTrue if BOM is present

 
 top of page
Method indexOf
Signature
indexOf(Strings,
  intoff 
  )  
 :int
Arguments
Strings
intoff
Returns
int

 
 top of page
Method indexOfChar
Signature
indexOfChar(charc,
  intoff 
  )  
 :int
Arguments
charc
intoff
Returns
int

 
 top of page
Method indexOfControlCharacter
Signature
indexOfControlCharacter(charc)
 :int
Arguments
charc
Returns
int

 
 top of page
Method indexOfFirstDifference
Signature
indexOfFirstDifference(Stringo)
 :int
Arguments
Stringo
Returns
int

 
 top of page
Method indexOfWordEnd
Signature
indexOfWordEnd(intoff)
 :int
Arguments
intoff
Returns
int

 
 top of page
Method indexOfWordStart
Signature
indexOfWordStart(intoff)
 :int
Arguments
intoff
Returns
int

 
 top of page
Method insert
This method supports the => operator.
Signature
insert(intindex,
  Strings 
  )  
 :String
Arguments
intindex
Strings
Returns
String

 
 top of page
Method isBlank
Signature
isBlank():boolean
Returns
boolean

 
 top of page
Method isPredecessor
Check whether String is lexicographical predecessor of other string.
Signature
isPredecessor(Stringo,
  booleanbCaseSensitive 
  )  
 :boolean
Arguments
StringoOther string
booleanbCaseSensitivetrue=perform case sensitive comparison
Returns
booleantrue or false

 
 top of page
Method isUTF8
Check if string starts with UTF-8 byte order mark (see →hasUTF8BOM) or if it contains any UTF-8 multi-byte chars
Signature
isUTF8():boolean
Returns
booleanTrue if BOM or UTF-8 multi-byte chars are present

 
 top of page
Method lastIndexOf
Signature
lastIndexOf(Strings)
 :int
Arguments
Strings
Returns
int

 
 top of page
Method load
Signature
load(StringfileName,
  booleanbRemoveCR 
  )  
 :boolean
Arguments
StringfileName
booleanbRemoveCR
Returns
boolean

See also:  


 
 top of page
Method loadLocal
Signature
loadLocal(StringfileName,
  booleanbRemoveCR 
  )  
 :boolean
Arguments
StringfileName
booleanbRemoveCR
Returns
boolean

 
 top of page
Method New
Signature
New(Strings)
 :String
Arguments
Strings
Returns
String

 
 top of page
Method numCharsAt
Count number of consecutive characters at the given string offset.
Signature
numCharsAt(charc)
 :int
Arguments
charc
Returns
intNumber of consecutive chars

 
 top of page
Method numIndicesOf
Signature
numIndicesOf(Strings)
 :int
Arguments
Strings
Returns
int

 
 top of page
Method parseXML
Signature
parseXML():TreeNode
Returns

 
 top of page
Method patternMatch
Signature
patternMatch(Stringpattern)
 :int
Arguments
Stringpattern
Returns
int

 
 top of page
Method putc
Signature
putc(intoffset,
  charc 
  )  
Arguments
intoffset
charc

 
 top of page
Method realloc
Signature
realloc(intbufSize)
 :boolean
Arguments
intbufSize
Returns
boolean

 
 top of page
Method replace
Replace all occurences of String a by String b.
Signature
replace(Stringa,
  Stringb 
  )  
Arguments
Stringa
Stringb
Description

This method supports the => operator.

 
 top of page
Method replaceChar
This method supports the => operator.
Signature
replaceChar(chara,
  charb 
  )  
 :String
Arguments
chara
charb
Returns
String

 
 top of page
Method replaceCharReturnNum
Signature
replaceCharReturnNum(chara,
  charb 
  )  
 :int
Arguments
chara
charb
Returns
int

 
 top of page
Method replaceIncludes
Signature
replaceIncludes(StringoptFilePrefix)
 :int
Arguments
StringoptFilePrefix
Returns
int

 
 top of page
Method replaceRegion
This method supports the => operator.
Signature
replaceRegion(intstartOff,
  intendOff,
  Strings 
  )  
 :String
Arguments
intstartOff
intendOff
Strings
Returns
String

 
 top of page
Method replaceReturnNum
Signature
replaceReturnNum(Stringa,
  Stringb 
  )  
 :int
Arguments
Stringa
Stringb
Returns
int

 
 top of page
Method resubstEscapeSeq
Replace internal escape sequences by ASCII-style ones.
Signature
resubstEscapeSeq()
Description

Please see script engine source for details.

See also:  


 
 top of page
Method resubstEscapeSeq2
Replace internal escape sequences by script-parseable ASCII-style ones.
Signature
resubstEscapeSeq2()
Description

Please see script engine source for details.

See also:  


 
 top of page
Method revIndexOfChar
Signature
revIndexOfChar(charc,
  intoff 
  )  
 :int
Arguments
charc
intoff
Returns
int

 
 top of page
Method saveLocal
Signature
saveLocal(StringfileName)
 :boolean
Arguments
StringfileName
Returns
boolean

 
 top of page
Method setQuotFlag
Set quotation flag
Signature
setQuotFlag(intflag)
Arguments
intflag

 
 top of page
Method split
Deprecated:  Use splitChar() instead
Signature
split(chardelimiter)
 :int
Arguments
chardelimiter
Returns
int

 
 top of page
Method splitChar
This method supports the => operator.
Signature
splitChar(chardelimiter)
 :StringArray
Arguments
chardelimiter
Returns

 
 top of page
Method splitCharset
This method supports the => operator.
Signature
splitCharset(StringdelimiterCharset)
 :StringArray
Arguments
StringdelimiterCharset
Returns

 
 top of page
Method splitSpace
This method supports the => operator.
Signature
splitSpace(booleanbQuotes)
 :StringArray
Arguments
booleanbQuotes
Returns

 
 top of page
Method startsWith
Signature
startsWith(Strings)
 :boolean
Arguments
Strings
Returns
boolean

 
 top of page
Method substEscapeSeq
Replace ASCII-style escape sequences by internal ones.
Signature
substEscapeSeq()
Description

This method is mostly useful when generating script source.Please see script engine source for details.

See also:  


 
 top of page
Method substring
This method supports the => operator
Signature
substring(intoff,
  intlen 
  )  
 :String
Arguments
intoff
intlen
Returns
String

 
 top of page
Method tokenize
Split string at delimiter chars and return substring array.
Signature
tokenize(StringdelimiterCharset)
 :StringArray
Arguments
StringdelimiterCharset
Returns
Description

This method supports the => operator.
Unlike splitCharset(), the result array will contain the delimiter chars and this method will consider quoted strings.

 
 top of page
Method tokenizeWithRanges
Split string at delimiter chars and return substring and startoffset+numchars arrays.
Signature
tokenizeWithRanges(StringdelimiterCharset,
  IntArrayretRanges 
  )  
 :StringArray
Arguments
StringdelimiterCharset
IntArrayretRangesreturns the substring start offsets and lengths (two elements for each substring)
Returns
Description

This method supports the => operator.
Unlike splitCharset(), the result array will contain the delimiter chars and this method will consider quoted strings.

 
 top of page
Method toLower
This method supports the => operator.
Signature
toLower():String
Returns
String

 
 top of page
Method toUpper
This method supports the => operator.
Signature
toUpper():String
Returns
String

 
 top of page
Method trim
This method supports the => operator.
Signature
trim():String
Returns
String

 
 top of page
Method utf8ToASCII
Convert UTF-8 string to ASCII.
Signature
utf8ToASCII()
Description
Replace non-ASCII chars (>=128) with SUB (26) character.

 
 top of page
Method utf8ToCP1252
Convert UTF-8 string to CP1252 extended ASCII.
Signature
utf8ToCP1252()
Description
Replace non-convertable chars with SUB (26) character.
(note) CP1252 is the same as ISO8859-1 except for the 0x80..0x9F area (ctl codes in ISO)(note) CP1252 is the HTML5 default encoding for text labeled as ISO8859-1

 
 top of page
Method visit
Signature
visit(Strings,
  intoff,
  intlen 
  )  
Arguments
Strings
intoff
intlen

 
 top of page
Method wasQuoted
Check whether String was originally enclosed in \"\" or \'\'
Signature
wasQuoted():boolean
Returns
booleanflags

 
 top of page
Method wasQuotedDouble
Check whether String was originally enclosed in \"\"
Signature
wasQuotedDouble():boolean
Returns
booleanflags

 
 top of page
Method wasQuotedSingle
Check whether String was originally enclosed in \'\'
Signature
wasQuotedSingle():boolean
Returns
booleanflags

 
 top of page
Method wordIndexAtCharIndex
Find word index at char index.
Signature
wordIndexAtCharIndex(intcharIndex,
  booleanbQuot 
  )  
 :int
Arguments
intcharIndex
booleanbQuottrue=conside words enclosed in \"\" or \'\' as one word
Returns
intwordIndex or -1 if not found

 
 top of page
Method words
Deprecated:  Use splitSpace() instead
Signature
words(booleanbQuotes)
 :int
Arguments
booleanbQuotes
Returns
int

 
 top of page
 

Project Modules:core 
Project Classes:Boolean , Buffer , Byte , Class , ClassArray , Condition , Configuration , Double , DummyStream , Envelope , Event , Exception , File , Float , FloatArray , FloatArray128 , FloatArray16 , FloatArray32 , FloatArray64 , FloatArray8 , Function , HashTable , IntArray , IntArray128 , IntArray16 , IntArray32 , IntArray64 , IntArray8 , Integer , LFSR , LFSR_NR , List , ListNode , Long , Mailbox , Mutex , Object , ObjectArray , PakFile , PointerArray , Pool , Process , Script , SharedBuffer , Short , Stack , StdErrStream , StdInStream , StdOutStream , Stream , String , String128 , String16 , String32 , String64 , String8 , StringArray , StringIterator , Thread , Time , TKS , TreeNode , UnsignedByte , UnsignedInteger , UnsignedLong , UnsignedShort , Value , ValueArray , Variable 
Project Functions:ceil , exit , floor , GetCurrentThread , getenv , lcchar , mathAbsMaxf , mathAbsMinf , mathAbsMini , mathAbsMini , mathCerpf , mathClampf , mathClampi , mathDistancePointPlane2d , mathFoldf , mathFoldi , mathGCD , mathLerpCyclicf , mathLerpf , mathMaxf , mathMaxi , mathMinf , mathMini , mathNextCyclicf , mathPowerf , mathPowerfC , mathPoweri , mathSerpf , mathSmoothStepf , mathSmoothStepNf , mathWrapf , mathWrapi , milliSeconds , milliSecondsDouble , psystem , putenv , srand , system , ucchar 
All Namespaces:default , graph , ui 
All Projects:core , eqxmms , ShaderVG , ShaderVG_Text , tkanalogrytm , tkchipmunk , tkclap , tkfileutils , tkfreeglut , tkfreetype2 , tkfreeverb , tkmath , tkmidi , tkmidipipe , tkminnie , tkoldmath , tkopengl , tkportaudio , tkradiastools , tksamplechain , tksampleedit , tksampler , tksdl , tksdl_net , tksidplay2 , tkspeexdsp , tksqlite , tktriangulate , tkui , tkvst2 , tkzip , ui , yingtest 


auto-generated by "DOG", the TkScript document generator. Thu, 11/Dec/2025 13:41:59