Note that there are some explanatory texts on larger screens.

plurals
  1. POremoving white spaces from string value
    primarykey
    data
    text
    <p>i have a link <code>http://localhost:8080/reporting/pvsUsageAction.do?form_action=inline_audit_view&amp;days=7&amp;projectStatus=scheduled&amp;justificationId=5&amp;justificationName= No Technicians in Area</code> in my struts based web application.</p> <p>The variable in URL <code>justificationName</code> have some spaces before its vales as shown. when i get value of <code>justificationName</code> using <code>request.getParameter("justificationName")</code> it gives me that value with spaces as given in the URL. i want to remove those spaces. i tried <code>trim()</code> i tries <code>str = str.replace(" ", "");</code> but any of them did not removed those spaces. can any one tell some other way to remove the space. </p> <p>Noted one more thing that i did right click on the link and opened the link into new tab there i noticed that link looks like. </p> <pre><code>http://localhost:8080/reporting/pvsUsageAction.do?form_action=inline_audit_view&amp;days=7&amp;projectStatus=scheduled&amp;justificationId=5&amp;justificationName=%A0%A0%A0%A0%A0%A0%A0%A0No%20Technicians%20in%20Area </code></pre> <p>Notable point is that in the address bar it shows <code>%A0</code> for white spaces and also show <code>%20</code> for space as well see the link and tell the difference please if any one have idea about it.</p> <p><strong>EDIT</strong> Here is my code </p> <pre><code>String justificationCode = ""; if (request.getParameter("justificationName") != null) { justificationCode = request.getParameter("justificationName"); } justificationCode = justificationCode.replace(" ", ""); </code></pre> <p>Note: replace function remove the space from inside the string but not removing starting spaces. e-g if my string is " This is string" after using replace it becomes " Thisisstring"</p> <p>Thanks in advance </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload