AppleScript remove spaces from do shell script result

I am getting a count of files with a certain name extension in a directory chosen by the user like so:


set fileCount to do shell script "find " & (quoted form of usrTarget) & " -name \"*.asd\" | wc -l"



When the resulting number is printed in my confirmation dialog:


set confirmDialog to display dialog "Found" & (fileCount) & " files with the name extension \".asd.\" Ready to delete? This action cannot be undone!" with icon file rxIcon buttons {"Abort", "Delete"} default button "Delete"



The dialog works fine, but it keeps the spaces that are included in the output of the shell script. How would I go about removing those spaces from my "fileCount" variable for the sake of the dialog not looking weird? e.g


"Found: 104 files with the name extension .asd." instead of

"Found: 104 files with the name extension .asd."

Answered by red_menace in 422479022

In AppleScript, the words of a string are where there is a continuous series of letters, numbers, and certain symbols, so an easy way to get rid of that whitespace would be to get the first word, for example:


first word of fileCount
Accepted Answer

In AppleScript, the words of a string are where there is a continuous series of letters, numbers, and certain symbols, so an easy way to get rid of that whitespace would be to get the first word, for example:


first word of fileCount

Thanks again.

AppleScript remove spaces from do shell script result
 
 
Q