[Webinar] Streamline your web hosting managementRegister Today

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

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


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

1 Solution
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>
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 ?
[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> ?
len(variable1 & variable2 & variable3 & etc)

<cfset temp = ""/>
<cfoutput query="name">
     <cfset temp = temp & queryField/>
represente03Author Commented:
ok thanks and last thing please, how can i say that:  after 200 characters, "do this" ?
> 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


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