Alpha Video Training
Results 1 to 2 of 2

Thread: formatting strings & word_tagged_pattern

  1. #1
    Member
    Real Name
    Blake Watson
    Join Date
    Jan 2003
    Posts
    961

    Default formatting strings & word_tagged_pattern

    Hey, gang:

    I was looking for a way to format strings, something akin to a routine found in other languages, like:


    format("The %s fox jumped over %d fences on %t.", "quick, brown", 14, "08/30/2003") -> "The quick, brown fox jumped over 14 fences on August 30, 2003."


    I didn't see one in the xBasic reference, but I thought I could maybe use Word_Tagged_Pattern. It's sort of overkill, but it's sooo easy to make mistakes formatting using just "+" and "quote()".

    Unfortunately, it doesn't work as described. Even the help examples are off. Like this:


    word_tagged_pattern("1/2/3", "2-1-3", "2/29/00") * "29-2-00"


    Actually produces:


    = "-2-/29--/00--"


    The earlier example in the help, which should produce something like "Fred Smith~123 Main Street~Boston, MA 02116" actually produces:

    "Fred ~~, : Smith~~, : 123~~, Main ~~, Street ~~, : Boston~~, : Ma~~, : 02116~~, "

    So, anyway, word_tagged_pattern is out. And I find that I need a format-like function more than usual in A5, because I do a lot of stuff with embedded strings.

    Thoughts?

  2. #2
    Member
    Real Name
    Blake Watson
    Join Date
    Jan 2003
    Posts
    961

    Default RE: formatting strings & word_tagged_pattern

    Oh, never mind.

    I've been using StrTran for months--just totally blanked on it!

    :-)

Similar Threads

  1. Cannot Enter Certain Strings
    By Steve Andrews in forum Forum Usage
    Replies: 2
    Last Post: 09-27-2005, 11:44 AM
  2. Extracting strings from a Variable
    By John Castle in forum Alpha Five Version 5
    Replies: 10
    Last Post: 09-16-2005, 09:21 AM
  3. Strings in A5 null terminated?
    By Marcel Kollenaar in forum Alpha Five Version 6
    Replies: 6
    Last Post: 07-26-2004, 12:48 PM
  4. problem/w character strings:
    By BigMac in forum Alpha Five Version 5
    Replies: 11
    Last Post: 04-22-2004, 08:37 AM
  5. Zero Length Strings?
    By Bill Walker in forum Alpha Five Version 5
    Replies: 18
    Last Post: 01-30-2004, 04:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •