Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

VBScript help

Options
  • 22-06-2007 2:54pm
    #1
    Registered Users Posts: 383 ✭✭


    Hey lads,

    I want to use a the replace function to change a string of data.

    input data format
    123-****-ABC

    required output data format
    123AB-****-321

    * = random number

    The data is consistent so I can use the replace function. i.e. 123 is a constant and only the * numbers will change.

    Any help would be greatly appreciated.

    j


Comments

  • Registered Users Posts: 2,781 ✭✭✭amen


    RTFM or failing that google it


  • Registered Users Posts: 7,544 ✭✭✭irlrobins


    outString='123AB-'&Mid(inputString,5,4)&'321'


  • Registered Users Posts: 383 ✭✭jaarius


    @irlrobins:Thanks,

    This is all very new but I got something that worked. Had network issues here so I couldn't post up earlier that I was sorted.

    The app I am using uses VBScript to manipulate data input data. I used the following;

    replace(replace(aString,"ABC","123"),"123","123AB")

    and that seems to work.

    @Amen: why even bother replying replying with that?

    j


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    jaarius wrote:
    @Amen: why even bother replying replying with that?
    Because you came looking for help before making any effort yourself. The fact that you later were able to find a solution on your own shows how little effort you put into it before getting others to help you out.

    Technical mailing lists, notice boards and the like should be considered the last port of call, not the first. So if you get flamed when it's obvious that you made no effort before coming here then accept it. After all, no one likes to be asked to help out a moocher.


  • Registered Users Posts: 383 ✭✭jaarius


    Because you came looking for help before making any effort yourself. The fact that you later were able to find a solution on your own shows how little effort you put into it before getting others to help you out.

    Technical mailing lists, notice boards and the like should be considered the last port of call, not the first. So if you get flamed when it's obvious that you made no effort before coming here then accept it. After all, no one likes to be asked to help out a moocher.

    Asking for help on boards.ie is never my first option. I would much rather figure something out and actually learn about it rather than just have somebody hand me the answer. I am not at all familiar with VBScript and it was only when someone pointed out to me that I could nest a replace function within a replace function did I work it out. Easy? Sure when you know how or even what to look up. I checked out several beginners guides and couldn't find a solution.

    I was stuck and needed help with it.

    If this thread is not of any use to this forum can you please lock/delete it?

    j


  • Advertisement
  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    The reason I didn't lock this thread when I first read it was to allow our regular posters to voice their frustrations, regular being those who regularly help others with their programming problems. I will continue to leave it open for that reason.

    Using the tag you supplied for this thread in Google returned these results. I'm quite sure there's a solution in there seeing as thats what you used in the end.

    There is a charter in place on the forum jaarius, I suggest you read it.


  • Closed Accounts Posts: 19,777 ✭✭✭✭The Corinthian


    jaarius wrote:
    Asking for help on boards.ie is never my first option.
    It pretty much was. Google pretty much gave you your answer, and you didn't need much prompting in the end to work it out yourself. So be honest, you didn't really kill yourself working it out on your own, did you?
    If this thread is not of any use to this forum can you please lock/delete it?
    Take the flame like a big boy and move on.


  • Registered Users Posts: 383 ✭✭jaarius


    Evil Phil wrote:
    thread in Google returned these results. I'm quite sure there's a solution in there seeing as thats what you used in the end.

    The first two results here provide the guides that I referenced before posting to boards.ie.
    w3schools was my first port of call (as always) and where I found out about the replace function to begin with. I couldn't find anything on different the webmasters guide because they both cover the same things. I got the nesting idea from one of the lads in the eng department. So google/w3schools did solve half of the problem. However, the other part (replacing the second piece of data from the string) I could not find the answer to and so asked here. So I hit a wall after using the beginners guide on w3 and then I asked here.

    Also I had read the charter before I posted to see if this was the place for newbie questions. If I am out of line I have no problem with a mod flaming me but I honestly thought my post satisfied the charter.

    j


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Fair enough, but the charter does state that you should post some code so perhaps you should do that next time. People who use the forum are only to glad to help newbies as long as they appear to be making an effort themselves.

    I'll lock this now.


This discussion has been closed.
Advertisement