split text after and before # or coma



  • I have this line in my file
    E:\APPDEV\YefizMoney\store\quiz\quiz9.JPG # you have new text

    I want to use E:\APPDEV\YefizMoney\store\quiz\quiz9.JPG in one element and "you have new text" into other element of website

    can anyone explain and I am new and trying to learn.
    I tried using parse line but it uses : to separate the text



  • @spa3212, execute code

    var test = "E:\\APPDEV\\YefizMoney\\store\\quiz\\quiz9.JPG # you have new text";
    
    var test1 = test.split("#")[0]; //"E:\APPDEV\YefizMoney\store\quiz\quiz9.JPG "
    
    var test2 = test.split("#")[1]; //" you have new text"
    


  • Many Thanks for taking considering my question, I really appreciate your help.
    actually look like I failed to explain here one more time..

    the data is in my text file, like
    E:\APPDEV\YefizMoney\store\quiz\quiz9.JPG # you have new text 1
    E:\APPDEV\YefizMoney\store\quiz\quiz8.JPG # you have new text 2
    E:\APPDEV\YefizMoney\store\quiz\quiz7.JPG # you have new text 3

    and so on,

    How can I split the text that is a location of image from text after #
    I want to set image location part as variable let say image_part
    and Test_part for text part.

    So that I can use them in two different elements.

    I want to create a simple loop that will pick each line data one by one. it upload image and then write text one done, it loop and move to second line.

    Thanks



  • @spa3212, execute code

    [[IMAGE_PART]] = [[INITIAL_VARIABLE]].split("#")[0];
    [[TEXT_PART]] = [[INITIAL_VARIABLE]].split("#")[1];
    

    *[[INITIAL_VARIABLE]] - variable with "E:\APPDEV\YefizMoney\store\quiz\quiz9.JPG # you have new text 1"



  • I want to use resource file. this code worked fine, but
    how can I use resource file,
    it worked I set single text line as you provided. But If use resource file with set variable it don't
    https://prnt.sc/qtmbip



  • @spa3212
    IT WORKED NOW..MANY MANY THANKS


Log in to reply