[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1715
  • Last Modified:

how can i count number of characters in string with coldfusion ?

hi,

i want to count the number of characters in string (access database) with coldfusion. any solution ?

thanks
0
represente03
Asked:
represente03
1 Solution
 
SViewCommented:
Try this

ListLen(string, "/"), this will split the string on each /  you will then need to -1 from the count of the result and this should  give you the /
 
 <cfset slashCount =  ListLen(string, "/") - 1>
0
 
represente03Author Commented:
sview it's not a word that i want to find but the number of all characters in string.

HyperBPP the function len() is a good solution i have test it but how can i count the number of characters of several string ?
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
represente03Author Commented:
how can i addition these several characters in a <cfoutput query> ?
0
 
HyperBPPCommented:
len(variable1 & variable2 & variable3 & etc)

<cfset temp = ""/>
<cfoutput query="name">
     <cfset temp = temp & queryField/>
</cfoutput>
<cfoutput>len(temp)</cfoutput>
0
 
represente03Author Commented:
ok thanks and last thing please, how can i say that:  after 200 characters, "do this" ?
0
 
_agx_Commented:
> but how can i count the number of characters of several string ?

It depends. In some cases it makes more sense to do the counting in CF, while in others you'd use a db function. For example, if you wanted to get the maximum length of all values in a column named "LastName", you'd use the db functions. The function names are db dependent: MS SQL it is LEN(), MySQL it's LENGTH(), etc....

SELECT  MAX(LEN(LastName)) AS MaxLength FROM SomeTable

0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now