Forum Discussion

meenakshiyadav1's avatar
meenakshiyadav1
Contributor
5 years ago
Solved

How to remove unwanted "/" from a string

I  am using FullName property of a label object and then splitting the string to get the Full Name of Dynamic parent.  This FullName Property returning the string as :"Mobile.Device(\"iPad\").Proces...
  • Wamboo's avatar
    Wamboo
    5 years ago

    Hi, meenakshiyadav1 ,

     

    I have made you a film showing my work with the "FullName" property of a given object.

     

    The video shows that you don't need to format a sequence of characters to create an object from such a sequence of characters taken from the "FullName" property.

     

    The problem you are presenting does not concern the character "\" at all. In programming languages, such a "\" character in a string means running away from special characters (in your case it is a " character) because the whole string is enclosed in double-quotes.

     

    So the correct character to remove from the string is " and not {What you see on the video}.

     

    Summary of the film:


    1) newStr -> represents the division of the character string into an array by " which may allow you to manipulate the array after it is connected. Note that if you glue it again in the string it will again show up "\" because it's an escape sign from special characters!

     

    2) WWFUllName, ReplaceWWWFUllName, ReplaceWWFUllName2
    Here you can see that it is not possible to format this string using a character \ you can do it by " (as above)

     

    3) evalObjECT and result
    Create an object from a string of characters taken from the FullName property and then extract the property from it.

     

    Is that what you mean?

     

    In general, know that you can dynamically search for such elements using .find() by looking at the structure of objects and not only downwards but also upwards using a property such as .Parent.

     

    Let me know if this helped you.