Questions tagged [string-length]

String length most commonly refers to the number of characters contained within a string. However, it could also mean the screen space a string takes up when printed.

This tag should be used for either of the two following types of questions:

  1. Those dealing with the number of characters contained within a string.
  2. Those dealing with measuring the size of a string (in pixels, millimeters, etc.) when it is printed on a screen.
1040 questions
-3
votes
2 answers

How to fetch the length of a string and fetch values?

How to fetch the length and individual values in javascript here is example data examples: "numbers": "248001,248142", "numbers": "588801,248742,588869" Actuall code { "_id" :…
Schüler
  • 512
  • 4
  • 10
  • 25
-3
votes
1 answer

How to find 00000000 in memory with python the way C does using while != 00000000

every time a computer stores a string in memory, for example the word 'apple', it's not using 5 characters, it's using 6 characters, 'a','p','p','l', 'e' + 'null' therefore putting 00000000 aka '\0' in the last byte. so here is the code that would…
DADI
  • 41
  • 5
-3
votes
5 answers

individual string length in array javascript

I need to create a function that takes in four strings and returns an array containing the length of each string. I was given this: function stringLengths(str1, str2, str3, str4) { // } I've created an array of strings and I've searched google…
-3
votes
2 answers

Return value of function strlen()?

This is the definition of strlen i have goggled up. strlen( ) function counts the number of characters in a given string and returns the integer value. It stops counting the character when null character is found. Now according to me the strlen…
Kshitij Dhyani
  • 703
  • 2
  • 8
  • 23
-3
votes
2 answers

How do I read this "for-loop" code from freecodecamp

this is basically the code, I already got the right answer but I'm just trying to figure out how the process work total = 20 var myArr = [ 2,3,4,5,6]; var total = 0; for (var d = 0; d < myArr.length; d++){ total += myArr[d]; …
-3
votes
2 answers

How do I limit the length of a string so that if the length is more than 100 it will cause an error?

To further explain my question I have a method that prints the length of the String that user inputs. Im trying at the moment if i enter a string "hello" the out is '05'. If I enter a string that is more than 100 characters the out put would be…
Javon
  • 1
  • 1
-3
votes
1 answer

How to add a zero to the output of the String.length method if the length is less than 10?

I have a string as a parameter in my method and i am trying to print the length of the string in which i have succeded but I want to add a zero in front of the length if it is less than 10. I am getting the int cannot be referenced error, and not…
jav_rock
  • 1
  • 5
-3
votes
1 answer

Minus 1 or another value from a split.length? (Java)

How would you minus from a split.length method? Would you need to assign it to an int like the code below or would you have to store the split.length value. An example I want to minus 1 from the split.length value. String[] split = i.split( " "…
-3
votes
2 answers

Does characterAtIndex only have to be used for an NSString? And what is the main purpose of characterAtIndex?

I am writing an app on xcode and I am working on the code for the guess button so if the user enters a letter which is correct then the letter will appear in the location, length of the word in the label. I am using a characterAtIndex but an error…
-3
votes
2 answers

Finding longest text fragment in string array with conditions

Good evening. So I have a text file which contains multiple lines of text with separators. I need to find the longest text fragment with a condition, that the word's last letter has to be the first letter of the later word. That text fragment can…
feco
  • 53
  • 1
  • 2
  • 9
-3
votes
1 answer

How to find length of a string

how can i find a length of a string using data type " char " i tried it many time but i did not work . i also see cplusplus tutorial but could not fix example under below #include #include #include using namespace…
ABC
  • 13
  • 1
  • 2
  • 9
-3
votes
1 answer

Issues With length() And Multiples Of 3

If you get the length of a String using length(), the String always being multiples of 3 (in my case: "1.02.03.04.05.06.07.0 etc."). Each 3 characters representing a letter, with .1 indicating a capital letter. How do you use the length to find how…
Samuel Finzhry
  • 35
  • 1
  • 10
-3
votes
1 answer

How to use sorting to arrange a list of words based on length, when equal use alphabetical order?(without comparison tools)

How to use sorting to arrange a list of words based on length, when equal use alphabetical order? (without comparison tools)
iii
  • 1
-3
votes
3 answers

Padding string with 0's -- formatting style?

Ok, so I need to pad a string value with a certain number of 0s depending on whether the string is 6 characters in length or not. But the resulting value must be no more than 6 characters. For example: 123 should be changed to 000123 4567 should be…
Dejsa Cocan
  • 1,539
  • 3
  • 19
  • 56
-3
votes
2 answers

Java - How do I find the length of a string in an array?

All I need to know is how to find the length of the string inside of the array. I also would like to know how to find which string comes first in alphabetical order in the array.
Zach Fortney
  • 39
  • 1
  • 2
  • 2