Professional Web Applications Themes

Appending to a string? - Macromedia ColdFusion

How the heck do you append to a string doing something like this... if it is defined append a "|" and then the var to the end of a string <cfif isdefined("chk_Icases")> <cfset check = #chk_Icases#> </cfif> <cfif isdefined("chk_Iissues")> #Insert("|", check, (Len(check)+1))# #Insert(chk_Iissues, check, (Len(check)+1))# </cfif> <cfif isdefined("chk_Idoc")> #Insert("|", check, (Len(check)+1))# #Insert(chk_Idoc, check, (Len(check)+1))# </cfif> <cfif isdefined("chk_Iother")> #Insert("|", check, (Len(check)+1))# #Insert(chk_Iother, check, (Len(check)+1))# </cfif>...

  1. #1

    Default Appending to a string?

    How the heck do you append to a string doing something like this...

    if it is defined append a "|" and then the var to the end of a string

    <cfif isdefined("chk_Icases")>
    <cfset check = #chk_Icases#>
    </cfif>
    <cfif isdefined("chk_Iissues")>
    #Insert("|", check,
    (Len(check)+1))#
    #Insert(chk_Iissues, check,
    (Len(check)+1))#
    </cfif>
    <cfif isdefined("chk_Idoc")>
    #Insert("|", check,
    (Len(check)+1))#
    #Insert(chk_Idoc, check,
    (Len(check)+1))#
    </cfif>
    <cfif isdefined("chk_Iother")>
    #Insert("|", check,
    (Len(check)+1))#
    #Insert(chk_Iother, check,
    (Len(check)+1))#
    </cfif>

    JakeFlynn Guest

  2. #2

    Default Re: Appending to a string?

    Originally posted by: JakeFlynn
    How the heck do you append to a string doing something like this...

    if it is defined append a "|" and then the var to the end of a string

    <cfif isdefined("chk_Icases")>
    <cfset check = #chk_Icases#>
    </cfif>
    <cfif isdefined("chk_Iissues")>
    #Insert("|", check,
    (Len(check)+1))#
    #Insert(chk_Iissues, check,
    (Len(check)+1))#
    </cfif>
    <cfif isdefined("chk_Idoc")>
    #Insert("|", check,
    (Len(check)+1))#
    #Insert(chk_Idoc, check,
    (Len(check)+1))#
    </cfif>
    <cfif isdefined("chk_Iother")>
    #Insert("|", check,
    (Len(check)+1))#
    #Insert(chk_Iother, check,
    (Len(check)+1))#
    </cfif>

    <cfset check="i" & chk_Icases>

    externalError Guest

  3. #3

    Default Re: Appending to a string?

    thank you for the reply externalError
    The problem i am having is that say i do do

    <cfset check="i" & chk_Icases>

    how do i later on append information to the check var?

    JakeFlynn Guest

  4. #4

    Default Re: Appending to a string?

    ok tell me in words, what do you expect your code to do? coz honestly i don't understand the purpose of your code above ;)
    externalError Guest

  5. #5

    Default Re: Appending to a string?

    Heh sorry for the confusion

    If a check box is defined I want to append its value to a string, the same
    string for each check box in the group.

    so,

    <cfif isdefined("foo")>
    append foo to X
    </cfif>

    <cfif isdefined("bar")>
    append bar to X
    </cfif>

    ect.

    thanks

    JakeFlynn Guest

  6. #6

    Default Re: Appending to a string?

    All you have to do is reference the varaible in itself!

    <cfset check=check & newDataToAppend>
    Stressed_Simon Guest

  7. #7

    Default Re: Appending to a string?

    Man that was dumb, thats what i was looking for thanks!
    JakeFlynn Guest

Similar Threads

  1. Appending FLV files together on the fly
    By bill0bill in forum Macromedia Flash Flashcom
    Replies: 1
    Last Post: May 3rd, 10:09 AM
  2. Appending at various locations.
    By MJS in forum PERL Miscellaneous
    Replies: 3
    Last Post: September 8th, 12:41 PM
  3. Appending at various locations
    By MJS in forum PERL Beginners
    Replies: 0
    Last Post: September 7th, 05:15 AM
  4. appending multiple PDFs together.
    By Stephanie S in forum ASP
    Replies: 1
    Last Post: July 25th, 04:21 PM
  5. += vs << when appending arrays to an array
    By Doug Beaver in forum Ruby
    Replies: 1
    Last Post: July 16th, 08:57 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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139