Softquoted Strings

Prev Next

Introduction

The data subtype quoted string is applied in following cases:

Following features apply to softquoted strings only:

  • Symbols like '*' or '?' are treated as wildcards for comparisons and when the equal sign = or not-equal sign <> is used
    Note: This is not the case for the other comparison operators such as == and !=.
  • Accessing tables: A single point may be used to access the current coolumn if the table context allows this.
  • Shifted table column specifications: Table header names may be prefixed with one or more < or > to access neighboring columns.
  • Some functions support dedicated values in place of column header names in their parameeters, e.g. '#row' or '*' in specific function parameters such as in table lookup() and table consolidate().

With Text Inside Single Quotation Marks
  a[] = 'Hello World';
  b[] = 'Hello   World';
  c[] = '  Hello World  ';
  echo( 'a[] = "', a[], '"');
  echo( 'b[] = "', b[], '"');
  echo( 'c[] = "', c[], '"');
  echo( 'Subtype of a[] is ', subtype( a[] ) );
  echo( "Simple comparison returning 'true': ", Hello = '*llo' ); // softquoted strings support wildcards
Output:
a[] = "Hello World"
b[] = "Hello   World"
c[] = "  Hello World  "
Subtype of a[] is softquoted string
Simple comparison returning 'true': true
Try it yourself: Open LAN_Features_Data_subtype_softquoted_strings.b4p in B4P_Examples.zip. Decompress before use.
With Plain Text
  a[] = Hello World;
  b[] = Hello   World;
  c[] =   Hello World  ;
  
  echo( 'a[] = "', a[], '"');
  echo( 'b[] = "', b[], '"');
  echo( 'c[] = "', c[], '"');
  echo( 'Subtype of a[] is ', subtype( a[] ) );
  echo( "Simple comparison returning 'true': ", Hello = '*llo' ); // softquoted strings support wildcards

  echo;
  echo("Following texts are read as softquoted strings");
  a[] = 07.04.2020;         // String constant, because it contains two points
  b[] = 555 1212;           // Contains a space
  c[] = 1 Main St.;         // This is a valid string constant
  d[] = mike@example.com;   // Valid, too.  See note below.

  echo( 'a[] = "', a[], '"  Subtype: ', subtype(a[]));
  echo( 'b[] = "', b[], '"  Subtype: ', subtype(b[]));
  echo( 'c[] = "', c[], '"  Subtype: ', subtype(c[]));
  echo( 'd[] = "', d[], '"  Subtype: ', subtype(d[]));

  echo;
  echo("Combine softquoted and quoted string:");
  a[] = Hello + ' World';
  b[] = Hello + " World";
  echo( 'a[] = "', a[], '"  Subtype: ', subtype(a[])); // softquoted string
  echo( 'b[] = "', b[], '"  Subtype: ', subtype(b[])); // quoted string
Output:
a[] = "Hello World"
b[] = "Hello World"
c[] = "Hello World"
Subtype of a[] is softquoted string
Simple comparison returning 'true': true

Following texts are read as softquoted strings
a[] = "07.04.2020"  Subtype: softquoted string
b[] = "555 1212"  Subtype: softquoted string
c[] = "1 Main St."  Subtype: softquoted string
d[] = "mike@example.com"  Subtype: softquoted string

Combine softquoted and quoted string:
a[] = "Hello World"  Subtype: softquoted string
b[] = "Hello World"  Subtype: quoted string
Try it yourself: Open LAN_Features_Data_subtype_softquoted_strings_01.b4p in B4P_Examples.zip. Decompress before use.