Professional Web Applications Themes

string manipulation problem - Replace - ASP

Hi all, I'm new to ASP so this is probably a problem caused by me.... but here goes. I have been pulling some information from an access database (specifically a postcode) eg. GL3 2SD, I need to swap the space " " for an plus sign "+" and have been trying to use this code - <%Dim ModPostCode If GetPropertiesRecordset.Fields.Item("AddressPostCod e").Value <> "" Then ModPostCode=GetPropertiesRecordset.Fields.Item("Ad dressPostCode").Value Replace(ModPostCode, " " , "+") =ModPostCode%> Some other html........ <%End If%> But I get this Error - Microsoft VBScript compilation (0x800A0414) Cannot use parentheses when calling a Sub /searchresults.asp, line 354, column 31 Replace(ModPostCode, ...

  1. #1

    Default string manipulation problem - Replace

    Hi all,
    I'm new to ASP so this is probably a problem caused by me.... but here goes.

    I have been pulling some information from an access database (specifically a
    postcode)
    eg. GL3 2SD, I need to swap the space " " for an plus sign "+" and have been
    trying to use this code -

    <%Dim ModPostCode
    If GetPropertiesRecordset.Fields.Item("AddressPostCod e").Value <> ""
    Then

    ModPostCode=GetPropertiesRecordset.Fields.Item("Ad dressPostCode").Value
    Replace(ModPostCode, " " , "+")
    =ModPostCode%>
    Some other html........
    <%End If%>

    But I get this Error -

    Microsoft VBScript compilation (0x800A0414)
    Cannot use parentheses when calling a Sub
    /searchresults.asp, line 354, column 31
    Replace(ModPostCode, " " , "+")


    I have tested all the lines to make sure that the data is OK and in the
    variable 'ModPostCode', I just can't get the Replace command working... Any
    ideas... anyone... please....

    Cheers
    Coz.


    Coz Guest

  2. #2

    Default Re: string manipulation problem - Replace

    Coz wrote on 20 jul 2003 in microsoft.public.inetserver.asp.general:
    >Cannot use parentheses when calling a Sub
    > Replace(ModPostCode, " " , "+")
    > =ModPostCode%>
    >
    You are using repalce as a sub,
    but it is a function where you need to use the result:

    ModPostCode = Replace(ModPostCode, " " , "+")

    I suppose

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

  3. #3

    Default Re: string manipulation problem - Replace


    "Evertjan." wrote in message news:Xns93BED2289E87Eeejj99194.109.133.29...
    SNIP
    >
    > You are using repalce as a sub,
    > but it is a function where you need to use the result:
    >
    > ModPostCode = Replace(ModPostCode, " " , "+")
    >
    > I suppose
    >
    SNIP

    Cheers mate.... I'm happy 'again' - I did say that it was probably something
    I was doing.... Typical!!!

    Thanks
    Coz.


    Coz Guest

Similar Threads

  1. String Manipulation - Easiest Way?
    By Nanwedar in forum Macromedia ColdFusion
    Replies: 5
    Last Post: February 24th, 04:01 PM
  2. Another String Manipulation Question
    By Bill in forum Coldfusion - Advanced Techniques
    Replies: 4
    Last Post: February 21st, 03:31 AM
  3. String manipulation
    By Jerry Preston in forum PERL Beginners
    Replies: 2
    Last Post: January 19th, 01:27 PM
  4. String manipulation and category building.
    By Sean Williams in forum ASP
    Replies: 0
    Last Post: September 24th, 11:23 AM
  5. Replies: 4
    Last Post: September 12th, 04:19 PM

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