how to find white space between the string in coldfusion

I need to find the white space between a string in ColdFusion for example

str="ha    ppy"

Whitespace=4

i need to calculate how many white space between the str.

how to do that.

Answers


A simple regex:

<cfset str="ha    ppy">

<cfset spaces = reReplace(str, "\S+(\s+)\S+", "\1")>

<cfoutput>
    <pre>spaces = [#spaces#]</pre><br>
    #len(spaces)#
</cfoutput>

Need Your Help

Output for stargazer in R

r matlab stargazer

I follow the instruction of this article