Next Previous Up Contents
Next: Formats
Up: General Functions
Previous: Fluxes

### B.1.11 Strings

String manipulation and query functions.

concat( s1, s2 )
  Concatenates two strings. In most cases the same effect can be achieved by writing `s1+s2`, but blank values can sometimes appear as the string "`null`" if you do it like that.
concat( s1, s2, s3 )
  Concatenates three strings. In most cases the same effect can be achieved by writing `s1+s2+s3`, but blank values can sometimes appear as the string "`null`" if you do it like that.
concat( s1, s2, s3, s4 )
  Concatenates four strings. In most cases the same effect can be achieved by writing `s1+s2+s3+s4`, but blank values can sometimes appear as the string "`null`" if you do it like that.
equals( s1, s2 )
  Determines whether two strings are equal. Note you should use this function instead of `s1==s2`, which can (for technical reasons) return false even if the strings are the same.
equalsIgnoreCase( s1, s2 )
  Determines whether two strings are equal apart from possible upper/lower case distinctions.
startsWith( whole, start )
  Determines whether a string starts with a certain substring.
endsWith( whole, end )
  Determines whether a string ends with a certain substring.
contains( whole, sub )
  Determines whether a string contains a given substring.
length( str )
  Returns the length of a string in characters.
split( words )
  Splits a string into an array of space-separated words. One or more spaces separates each word from the next. Leading and trailing spaces are ignored.

  The result is an array of strings, and if you want to use the individual elements you need to use square-bracket indexing, with `[0]` representing the first object

split( words, regex )
  Splits a string into an array of words separated by a given regular expression.

  The result is an array of strings, and if you want to use the individual elements you need to use square-bracket indexing, with `[0]` representing the first object

matches( str, regex )
  Tests whether a string matches a given regular expression.
matchGroup( str, regex )
  Returns the first grouped expression matched in a string defined by a regular expression. A grouped expression is one enclosed in parentheses.
replaceFirst( str, regex, replacement )
  Replaces the first occurrence of a regular expression in a string with a different substring value.
replaceAll( str, regex, replacement )
  Replaces all occurrences of a regular expression in a string with a different substring value.
substring( str, startIndex )
  Returns the last part of a given string. The substring begins with the character at the specified index and extends to the end of this string.
substring( str, startIndex, endIndex )
  Returns a substring of a given string. The substring begins with the character at `startIndex` and continues to the character at index `endIndex-1` Thus the length of the substring is `endIndex-startIndex`.
toUpperCase( str )
  Returns an uppercased version of a string.
toLowerCase( str )
  Returns an uppercased version of a string.
trim( str )
  Trims whitespace from both ends of a string.
padWithZeros( value, ndigit )
  Takes an integer argument and returns a string representing the same numeric value but padded with leading zeros to a specified length.

Next Previous Up Contents
Next: Formats
Up: General Functions
Previous: Fluxes

TOPCAT - Tool for OPerations on Catalogues And Tables
Starlink User Note253
TOPCAT web page: http://www.starlink.ac.uk/topcat/
Author email: m.b.taylor@bristol.ac.uk
Mailing list: topcat-user@bristol.ac.uk