Prev: WebService
Next: Site updated
From: richard.townsendrose on 16 May 2010 10:22 Hi all Can someone explain to me the use of the square brackets and inverted commas for creating strings ... it seems to be a way of putting text into a text string ?????? but what are the rules ? and where do i find them... ------ me being more of a plumber than a programmer ----- for example for the awt library, there is a lot of code like this: ACCESS HTML CLASS HTMLLink LOCAL cString := "<a href=" AS STRING LOCAL oT AS OBJECT LOCAL x := 1 AS INT IF !(SELF:URL == "") cString += ["]+AllTrim(SELF:URL) ENDIF IF !(SELF:Anchor == "") cString += [#]+AllTrim(SELF:Anchor) ENDIF IF !(SELF:SearchString == "" ) cString += [?] oT := CreateInstance( #Tokenizer ) oT:AsString := SELF:SearchString cString += oT:AsArray[x] FOR x := 2 UPTO oT:Count cString += [+] + oT:AsArray[x] NEXT x ENDIF cString += [">] IF !(SELF:TextValue == "" ) cString += AllTrim(SELF:TextValue) ENDIF cString += [</a>] cString := SUPER:Caption(cString) RETURN cString Thanks Richard
From: Amilcar A. Camargo on 16 May 2010 13:14 Hi Richard, On Sun, 16 May 2010 07:22:04 -0700 (PDT), "richard.townsendrose" <richard.townsendrose(a)googlemail.com> wrote: >Hi all > >Can someone explain to me the use of the square brackets and inverted >commas for creating strings ... > >it seems to be a way of putting text into a text string ?????? >but what are the rules ? and where do i find them... > ------ me being more of a plumber than a programmer ----- Visual Objects provides three ways to delimit a string: double quotation mark: cText := "Hello world" single quotation mark: cText := 'Hello world' square brackets: cText := [Hello world] You can use any of them at any time. They are handy when you need to include in your string a double quotation mark (") for example. In some other languages you have to 'escape' it. Examples: cLink := [<a href="mypage.htm">This is my page</a>] cLink := '<a href="mypage.htm">This is my page</a>' as you can see, the string needs (") inside so you use one of the alternative ways to delimit it. HTH, Amilcar A. Camargo F. Guatemala, C. A.
From: richard.townsendrose on 17 May 2010 04:35 Amilcar Thanks you very much - it is so simple when you are told ! Regards Richard
|
Pages: 1 Prev: WebService Next: Site updated |