Function removes commas that are between quotes.  This is useful when an imported text file's record string values are separated by commas.  

 

Note:

This option does not remove commas in a comma separated string (see AsString function).  When numbers are not created within Trading Blox Builder, use the ReplaceString function to remove commas.

 

Often output from other systems and/or applications will put quotes around numbers with commas, in comma delimited files, so the number stays together in the same field.  When that happens this function is what is needed to correct that problem.  In use this happens when importing data from a file where the numbers might been copied from a report and were formatted with comma so make reading their value easier.  Not removing the comma from a comma separated list of values will cause the number with the comma to be view as two different values, instead of a single larger value.

 

For example, a comma separated string value read in from a file could have fields that are encased in quotes, and within that they may have additional commas. In order to use the GetField function on this string, it is necessary to remove the commas from between the quotes so the field count returned from GetFieldCount is correct. This function will also remove the quotes, since they are not required anymore.

 

The GetField function will read each value as a string, and convert numbers to numbers if necessary.

 

See also the RemoveNonDigits function to remove $ signs and other non digits from number strings.

 

Syntax:

RemoveCommasBetweenQuotes( inputString )

 

Parameter:

Description:

inputString

String from which commas are to be removed.

 

This is example uses a simple method to emulates the contents of what a file record might contain within some of its numeric fields.  

Example:

VARIABLES: stringRecord Type: String
 
'  Fabricate what a file record might appear.
stringRecord = "10,20,30," + Chr(34) + "40,000" + Chr(34) + ",50,60"
 
'  Show file record and how each of the fields will be interpreted.
PRINT "Orginal string from file:", stringRecord
PRINT "Field 4 is:", GetField( stringRecord, 4 ), _
    + " Field 5 is:", GetField( stringRecord, 5 )
PRINT      
'  Remove the comma from the field with a formatting comma.
stringRecord = RemoveCommasBetweenQuotes( stringRecord )
 
'  Show how removed comma record appears and how the field
'  problem has been avoided.
PRINT "New converted string: ", stringRecord
PRINT "Field 4 is:", GetField( stringRecord, 4 ), _
    + " Field 5 is:", GetField( stringRecord, 5 )

 

 

Results:

Orginal string from file: 10,20,30,"40,000",50,60

Field 4 is: "40  Field 5 is: 000"

 

New converted string:  10,20,30,40000,50,60

Field 4 is: 40000  Field 5 is: 50

 

Links:

Chr, GetField, GetFieldCount, RemoveNonDigits, ReplaceString

See Also:

Data Groups and Types

 


Edit Time: 9/25/2017 09:09:56 AM


Topic ID#: 496

 

Created with Help & Manual 7 and styled with Premium Pack Version 2.80 © by EC Software