>  Docs Center  >  Libraries  >  Buie  >  DEQUOTE
Libraries

DEQUOTE

DEQUOTE

Name


  dequote

Purpose (one Line Only)


  Reconvert a string processed by QUOTE, or from the result of a MySQL query.

Description


  In its simplest form this routine will take a string output from QUOTE
  and convert it back to its input. This means removing leading and trailing
  single quotes, and converting "\\" and "\'" to "\" and "'", respectively.
  If the input string has embedded "\n" strings it will be broken into a
  string array on the "\n" boundaries, with the '\n" themselves removed.
  In this case, the output is a string vector- otherwise, it is a scalar.
  Please note that because QUOTE is a many to one mapping in general,
  the sequence dequote(quote(x)) returns a string that may not be
  identical to x. (Eg, if x had leading blanks.) However, it should
  be possible to use the output of DEQUOTE with QUOTE again and obtain
  the same results with MySQl.
  Using the /SELECTSQL flag allows quote to be used with the output of
  mysql queries, particularly in processing TEXT and BLOB fields. The
  main difference with SELECTSQL set is that embedded "\" and "'" fields are
  left alone, except for \n which is again assumed to be a line boundary
  and used to break the string into substring elements.

Category


  Database

Calling Sequence


  result = dequote(string)

Inputs


  string - String to be processed

Optional Input Parameters


Keyword Input Parameters


  SELECTSQL- Flag, if set some of the processing of dequote is not done,
            specifically removal of backlash characters as escapes.

Outputs


  return value is a scalar string, or a string array if the input contained
  the "\n" escape sequence. Back to back "\n" (corresponding to empty lines)
  in the input will result in empty substrings in the array returned.

Keyword Output Parameters


Common Blocks


Side Effects


Restrictions


  Newlines are currently quoted with two characters: '\n' where the
  n is a literal lower case n. DEQUOTE will not do anything with embedded
  actual newline (012') characters, whether or not they are preceded by '\'.
  Dequote has no equivalent of the LITERAL keyword for quote.
  Dequote does not remove any empty lines- for example,
                      dequote('\n\n\string\n\n')
  returns an array of 4 elements, 3 of which are empty strings.

Procedure


Modification History


  Written by Peter L. Collins, 2006/10/27, Lowell Observatory
  2006/12/11, PLC, small bug fix- to return scalar if 1 element.
  2016/10/25, MWB, added support for quoted semi-colon



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us