Switch to: V9V8V7V6V5

Valentina Class: String Methods

Valentina.EscapeString()

Declaration:

EscapeString( 
    inStr as String ) as String        

Parameters:

  • inStr The string to be escaped.

Description:

This utility function is used if you build a string out of an SQL query, which may use a single quote or escape character. This allows you to escape a string (usually from user input) before you concatenate that string into a SQL query.

If you set inForRegEx to TRUE, then the string is treated as a regular expression and before If the inForRegEx parameter is FALSE then only a single quote character is treated by this function.

Example:

res = Valentina.EscapeString( "Valentina's (day)" )
// res is "Valentina\'s (day)"	
 
query = "SELECT * FROM T WHERE f1 LIKE '" + s1 + "' OR f2 REGEX '" + s2 "'"

Valentina.EnumTypeGetLocales()

EnumTypeGetLocales( inStr as string) As VStringArray

This method should help you in case

  1. you use VENUM field type
  2. you have specified enum value strings for few languages
  3. you want to show them in GUI of your app

SQL command SHOW FIELDS returns all possible values of Enum types in some complex enough string in the field fld_specific_info.

  ('v1','v2','v3'), 'lang1':('lang1_v1','lang1_v2','lang1_v3'), 'lang2':('lang2_v1','lang2_v2','lang2_v3')
  or just:
  ('v1','v2','v3')

This method helps you to parse it on items.

It returns the list of locale names as VStringArray array. Notice that first items belong to 'en' always.

Example:

dim languages as VStringArray = Valentina.EnumTypeGetLocaleItems( inStr )
// result is: { 'en', 'lang1', 'lang2' }

Valentina.EnumTypeGetLocaleItems()

EnumTypeGetLocaleItems(inStr as string, inLocaleName as string) As VStringArray

The second helper method to parse VENUM string. It returns items for the specified locale name

Example:

dim itemsOfLang2 as VStringArray = Valentina.EnumTypeGetLocaleItems( inStr, 'lan2' )
// result is: { 'lang2_v1','lang2_v2','lang2_v3'}