• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

delete spaces

Guest
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

Hi i have a string of text and numbers which i want to insert into a table colum


(ApID)
values
('#ClubID##First##Sur##Phone#')

but i need to remove any spaces that may occur how can i do this inside the insert query?
TOPICS
Advanced techniques

Views

430

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

Look at the Replace function

#Replace(variableName, " ", "", "all")#

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

ok thanks i have

<cfset first = #Replace(firstName, " ", "", "all")# >
<cfset sec = #Replace(surName, " ", "", "all")# >
<cfset all = #show.id#show.phone##first##sec# >

but i think i am getting a carrage return somehere, so what i now need is to remove any - & / \ charicters and any spaces and any carrage returns so i get a nice alpha numeric value.

how can i do this?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

... or if you want only alpha-numeric values, try RegExReplace(). I don't know the exact syntax offhand. Something like

#reReplaceNoCase(theString, "[^0-9,a-z]", "", "all")#

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 05, 2007 Jun 05, 2007

Copy link to clipboard

Copied

ok thanks i am using

#reReplaceNoCase(getit.ClubID, "[^0-9,a-z]", "", "all")#

but how do i add 4 columns as the string?

ie i have clubid, firstname, surname, phone which i want to add as a string

do i just use a comma between each?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
May 31, 2007 May 31, 2007

Copy link to clipboard

Copied

The chr() function will help you. You have to put the ascii value of the carraige return inside the brackets. Google is your freind.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Jun 05, 2007 Jun 05, 2007

Copy link to clipboard

Copied

LATEST
> do i just use a comma between each?
No.

>but how do i add 4 columns as the string?
Same way you did in your original example.

'#ClubID##First##Sur##Phone#'

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation