Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

Deleting all white spaces in a string

.replaceAll(/s/g,'')
Comment

Remove whitespace from str

name = name.strip()
Comment

remove white spaces

//Extenion function
fun String.removeWhitespaces() = replace(" ", "")

// Uses
var str = "This is an example text".removeWhitespaces()

println(str)
Comment

Remove White Space At Sides

$x = "  abc  ";
print(trim($x));

There are three versions of trim().
trim(): trims white space on both ends
rtrim(): trims white space on the right end
ltrim(): trims white space on the left end

Note that trim() does not remove white space in the middle of the string.
Comment

PREVIOUS NEXT
Code Example
Javascript :: nodejs get all folders in directory 
Javascript :: install bun.sh 
Javascript :: javascript get device 
Javascript :: jquery remove keypress event 
Javascript :: http get request js 
Javascript :: javascript un hiden element 
Javascript :: how to negate a boolena variable javascript 
Javascript :: javascript click event notifications 
Javascript :: js cypress div text 
Javascript :: js sort asendenet 
Javascript :: Detecting a mobile browser 
Javascript :: how to pass props in react test cases 
Javascript :: package json add git repo 
Javascript :: difference between shift and unshift in javascript 
Javascript :: html javascript call function after pressing enter 
Javascript :: useHistory react testing 
Javascript :: Jspinner max and min value 
Javascript :: back button js 
Javascript :: get all div elements javascript 
Javascript :: discount calculator javascript 
Javascript :: open a html file using js 
Javascript :: activeClassName react router 
Javascript :: javascript skip default parameter 
Javascript :: regular expression match text between quotes 
Javascript :: javascript check if is nan 
Javascript :: jquery set a value in td 
Javascript :: js date now format 
Javascript :: jquery get text 
Javascript :: package.json tilde vs caret 
Javascript :: get current date + 1 js 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =