PCE version 4C man_modulenamespaceid_tablemodified current_idOIxN class/stringN referenceC hash_tablerefersizeOIxNbothIsNM.string.S.translateCman_method_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherit diagnosticsdefaultsbugsOIxNM.string.S.translateRICdateOIx,}EN translatenCstringOIxMap all occurrences of `from' into `to'. If `to' is @nil, delete all `from' characters. The following translates a string holding a list of words line-by-line into a string where the words are separated by spaces: send(String, translate, '\n', ' ').nnnnnsNM.string.S.initialiseOIxNM.string.S.initialiseRIOIx5N initialisenOIxCreate a string object from a format specification and formatting arguments. See also ->format. To create a string holding a literal copy of another char_array object, enforce type-conversion, or use: new(S, string('%s', Original))nnnnnsNM.string.S.ensure_nlOI xNM.string.S.ensure_nlRIOI x,|N ensure_nlnOI xIf the last character of the string is not a newline (ASCII 10) a newline is appended. If additional text is provides this is appended too.nnnnnsNM.string.G.copyOI xNM.string.G.copyRIOI x,|NcopynOIxReturns a new instance of the same class with the same text. Equivalent to: get(S?class, instance, '%s', S). See also `char_array <-copy'.nnnnnsNM.string.S.untabifyOIxNM.string.S.untabifyRIOIx,}ENuntabifynOIxReplaces all tab characters (ASCII 9) by spaces, preserving the layout. The argument specifies the positions of the tab-stops. If this is an integer it specifies infinitely tab-stops at the specified intervals. If it is a vector it should be a vector of integers. If `tabs' is omitted `8' is used as a default value. The main application area is handling of plain (Unix) ASCII text.nnnnnsNM.string.S.ensure_suffixOIxNM.string.S.ensure_suffixRIOIx,|ٻN ensure_suffixnOIxbIf string does not have ->suffix, ->append the suffix. Notably useful for handling file suffixes.nnnnnsNM.string.S.truncateOIxNM.string.S.truncateRIOIx,|NtruncatenOIxTruncate the string to the specified number of characters. The following two calls are equivalent: send(String, truncate, 4) send(String, delete, 4)nnnnnsNM.string.S.formatOIxNM.string.S.formatRIOIx5NformatnOIxReplace the <-value of the string object using formatted output. Formatting is based on the C-language printf() standard library function. Argument objects are converted to the type requested by the format statement. If you have an implementation of the C-language on your computer, you may wish to check the documentation of printf (Unix: man printf). Various other classes implement the ->format method. See also `editor ->format', `text_buffer->format', `pce->format'. Prolog formatting may be used as an alternative by exploiting pce_open/3: ..., pce_open(View, append, Stream), format(Stream, 'Hello ~d-th ~w~n', [100, world]), close(Stream), ... The `format' argument to ->format is a string with two types of control-arguments. The % sign introduces a conversion statement, while the \ character introduces a special character. The % sign is optionally followed by a numeric argument, controlling the output.nnnnnsNM.string.S.insertOIxNM.string.S.insertRIOIx,|ENinsertnOIxInsert text at the given 0-based index. If index is @default this is equivalent to ->append. If index is 0 this is equivalent to ->prepend.nnnnnsNM.string.S.newlineOIxNM.string.S.newlineRIOIx-^INnewlinenOI xbAppend `times' newlines (default 1). This is equivalent to: send(String, append, string('\n')).nnnnnsNM.string.G.modifyOI!xNM.string.G.modifyRIOI"x,|ސNmodifynOI#xCreate a new string from the argument text. Defined as: modify(S, To:char_array, Result:string) :<- get(S, class, Class), get(Class, instance, '%s', To, Result). See `char_array <-modify' for details.nnnnnsNM.string.S.characterOI$xNM.string.S.characterRIOI%x-N characternOI&x?Change character at 0-based index. See also ->insert_character.nnnnnsNM.string.S.deleteOI'xNM.string.S.deleteRIOI(x,}ENdeletenOI)xDelete `length' characters starting at `from'. If `length' is omitted it deletes all characters starting at `from' to the end of the string.nnnnnsNM.string.S.insert_characterOI*xNM.string.S.insert_characterRIOI+x0Ninsert_characternOI,x Insert the given character `times' times at the given location. If `at' is @default, the character(s) is/are appended at the end of the string. If a string is to be created from a list of character codes, it is advised to create a string of the necessary length first using this method. The following illustrates this making a string with all characters between 0 and 255: new(S, string), send(S, insert_character, 0, 0, 256), forall(between(0, 255, I), send(S, character, I, I)). See also `string ->character'.nnnnnsNM.string.S.stripOI-xNM.string.S.stripRIOI.x4%NstripnOI/xtStrip all layout characters (see `pce <-syntax') from the start and/or and of the string. When the argument is `leading', only the layout characters at the start are removed. When `trailing', the layout characters at the end are removed. Otherwise (@default) they are removed from both ends. This method is regarded obsolete. New code should use `char_array <-strip'.CchainsizeOI0xIEN$class/regex$C.regexXnnnnsNC.stringCman_class_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherituser_interfacebugsOI1xNC.stringRIOI2x,|xNstringnOI3xA string object is a sequence of ASCII characters. Strings do not pose any limits on their size. They can contain any ASCII value, which the exception of the EOS character (`\0'). PCE various ways to represent text. See class char_array, class name and class text_buffer.OI4xIeN$class/text$C.textEN $topics$134XnnnXaCnumberOI5xx