How to remove all whitespace from a string

How to remove all whitespace from a string?
All whitespace characters from a string can be removed by using replace method replacing whitespace with null string
s = 'Test  string   with     white space '
s.replace(' ','')
'Teststringwithwhitespace'
gk