index



modules



license
coding style
to do



FScript functions to ait in string manipulations

  • TAB : read only variable containing the tab "t" character as string.
  • trim(str) : remove all whitespace at beginning and end of the given string.
  • upper(str) : return the given string converted to upper case.
  • lower(str) : return the given string converted to lower case.
  • left(str, count) : return the leftmost count chracters from the given string, or les if the string is too short.
  • right(str, count) : return the rightmost count chracters from the given string, or les if the string is too short.
  • mid(string, int start, int end : return the string which skips start characters and ends with character end (start and end modified to be in range).
  • length(string) : return the length of thegiven string.
  • toint(string, int base) : convert a string to an integer using the given base (default 10, 16 for hex etc). Returns zero ifthe value cannot be paresed asa valid integer.
  • todouble(string) : convert a string to a double. Returns zero if te given string is cannot be converted.
  • tostring(number, format) : convert a value to a string, using the given format (like sprintf but without the %).
  • isnum(string) : returns 1 when string contains only digits.
  • dateformat(date) : convert a "yyyyMMdd" date to a "dd.MM.yyyy" format. Returns "??" if the input is not 8 characters long.
  • timeformat(time) : convert a "hhmmssmmm" date to "hh:mm:ss.mmm" format, or something shorter when less some fields not provided.
  • stringadd(str,inc) : add a value (inc, integer) to a string representing a base 36 number.
  • ExtractString(string, sep, pos) : extract field pos (count starting at 1) from given string with given seperator. When less fields then requested, an empty string is returned.
  • StringContains(str, search) : returns TRUE when the first string contains the second.
  • quote(str) : return the given string quoted using double quotes, doubling the contained double quotes if any.
  • squote(str) : return the given string quoted using single quotes, doubling the contained single quotes if any.
  • line(str, line) : return the requested line from the given string, or an empty string if the line does not exist. Lines are seperated with newlines.
  • replace(string, what, with) : replace sequences of "what" in te given string with the value indicated by "with".
  • wordwrap(str, line, len) : return the requested line from the given string, using wordwrap with len characters on a line, or an empty string if the line does not exist.
  • increment(str) : tries to increment the number at the end of the string and returns that with the same prefix. If there is no number at the end, then the string itself is returned.

$Id: UtilScriptString.wiki 2587 2006-06-15 17:13:05Z triathlon98 $