Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string url = "www.google.com?cd=*|MMERGE25|*&mail=*|EMAIL|*&first=*|FNAME|*&last=*|LNAME|*&company=*|MMERGE4|*&cif=*|MMERGE58|*";
- string urlNeeded = url.replace("www.google.com?", ""); //Es un replace, pero simplement li estic dient que ho remplaçi per res, aixi que es mes un "borrar"
- //urlNeeded = cd=*|MMERGE25|*&mail=*|EMAIL|*&first=*|FNAME|*&last=*|LNAME|*&company=*|MMERGE4|*&cif=*|MMERGE58|*;
- string cleaned = url.replace('&', '=');
- //urlNeeded = cd=*|MMERGE25|*=mail=*|EMAIL|*=first=*|FNAME|*=last=*|LNAME|*=company=*|MMERGE4|*=cif=*|MMERGE58|*;
- string[] splitted = url.split('=');
- //splitted = [cd,*|MMERGE25|*,mail,*|EMAIL|*,first,*|FNAME|*,last,*|LNAME|*,company,*|MMERGE4|*,cif,*|MMERGE58|*];
- //splitted[0] = "cd";
- //splitted[1] = "*|MMERGE25|*";
- //splitted[2] = "mail";
- //splitted[3] = "*|EMAIL|*";
- //etc.
- int companyKeyIndex = splitted.indexOf("company");
- //companyKeyIndex = 8;
- int companyValueIndex = companyKeyIndex + 1;
- //companyKeyIndex = 9;
- string companyValue = splitted[companyValueIndex]
- //companyValue = "*|MMERGE4|*"
- string companyValueCleaned = companyValue.replace('*', ''); //El mateix que previament, es un replace pero enten-ho com borrar
- //companyValueCleaned = "|MMERGE4|";
- //si volguesis treure les barres tambe s'afegiria aquesta linia (sense crear una nova variable, utilitzant ja la que tens)
- companyValueCleaned = companyValue.replace('|', '');
- //companyValueCleaned = "MMERGE4";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement