String will be split when any of the characters is detected. One or more single characters, each of which is considered to be a separator.PatternĪ scalar string or a string array that can contain one of two types of information: ArgumentsĪ scalar string or a string array to be split into substrings. If String is an array of strings, then STRSPLIT returns a variable of type LIST, where each element of the list contains the result of calling STRSPLIT on a particular element of String. If String is a scalar string or 1-element string array, then STRSPLIT returns an array containing either the positions of the substrings or the substrings themselves (if the EXTRACT keyword is specified). Result = STRSPLIT( String ] ) Return Value Print, STRJOIN( STRSPLIT(Str, /EXTRACT), '-') To split a string on spans of whitespace and replace them with hyphens: Str = 'STRSPLIT chops up strings.' In this case a LIST is returned with the results. STRSPLIT can also be used to split an array of strings. The EXTRACT keyword can be used to cause STRSPLIT to return an array containing the substrings. By default, an array of the position of the substrings is returned. The STRSPLIT function splits its input String argument into separate substrings, according to the specified delimiter or regular expression. Tip: See also the IDL_String.Extract and IDL_String.Split methods, which provide similar functionality but with an object-oriented interface.
0 Comments
Leave a Reply. |