substitution of characters

Chris Sharman Chris.Sharman@ccagroup.co.uk
Wed, 25 Aug 1999 13:43:24 +0100


>Is the following possible in powerhouse (quick,quiz) :
>
>I have an item (for example char*25) that contains "THIS IS A TEST         
> " and I want
>to convert the spaces to underscores so that the item contains 
>"THIS_IS_A_TEST___________"

Easy to change the trailing spaces:

def newval char*25 = truncate(oldval)+"_________________________"

Harder to change embedded spaces:

def spac1 int*4 = index(newval," ")
def newval1 char*25 = newval if (spac1=0) &
		else newval[1:spac1 - 1]+"_"+newval[spac1+1:25]
def spac2 int*4 = index(newval1," ")
def newval2 char*25 = newval1 if (spac2=0) &
		else newval1[1:spac2 - 1]+"_"+newval1[spac2+1:25]
def spac3 ...

You could do it better with procedural code (only in Quick).

If you changed the substitution character from "^" to " " in the dictionary,
you could use the substitute function to do it fairly easily in either Quiz,
Quick, or QTP.

Chris
_______________________________________________________________________
Chris.Sharman@CCAgroup.co.uk		http://www.ccastat.demon.co.uk/
CCA Stationery Ltd, Eastway, Fulwood, Preston, Lancashire, PR2 9WS.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.