Count Character In String?

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Count Character In String?

    I have various strings that will be returned from a query, but I can to be able
    to remove the space and replace them with an underscore. For example:

    String=This is a string
    Result=This_is_a_string.

    I tried the find function, but it only finds the first one. I want to be able
    to find out that there are 3 space in this string.

    Thanks for the help

    twodaend Guest

  2. Similar Questions and Discussions

    1. Character count from Acrobat
      Hi all, I am using the Acrobat 8 professional version. I am using various application to generate the pdf. My clients need the number of...
    2. Character count from mutiple bookmarks in multiple files
      I have about 5000 pdf files that I need to get a character count on all the bookmarks. Is there a batch way to do this? I was assuming I would...
    3. count char in string
      hy all, I am trying to find a php function that can count howmany times a specific char is in a string. for example: $string = "Hello world";...
    4. How to replace a variable string within /* variable_string */ with x for each character in string?
      How to replace a variable string within /* variable_string */ with x for each character in string? The string may span on multiple lines. for...
    5. How do I count blocks of characters in a string variable?
      I'm trying to create a code to count a certain character in a string, lets say that I want to know how many letters "o" there are in the text "The...
  3. #2

    Default Re: Count Character In String?

    How about REPLACE(trim(string)," ","_","ALL")
    philh Guest

  4. #3

    Default Re: Count Character In String?

    Wow, that is exactly what I was looking for. I was making it harder than it
    had to be. I was going to do a loop and replace each space, but your way work
    10 time better and easier. Thanks for the help and the quick reply.

    twodaend Guest

  5. #4

    Default Re: Count Character In String?

    You should be able to use this function (with the DB-specific syntax, of course) directly in the query. Let the database do the data manipulation, then all you have to do is display the results.
    philh Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139