Arduino UNO skips a cicle while or for!!!!

Hi to all,
I create a custom library. I'm using 1/4 of arduino memory.
I found a strange behavior, I call a subroutine that returns me a count of item of string by a char.

All normal right?
NO!

If I use a monitor, I read "Test" and after "End Test".

I use 8.226 bytes (max 32.256 bytes)

Do I have a problem of memory?

BUT If I try this subroutine directly into the sketch, I receive a correctly behavior.
Are there a limit If I use a custom library?

Into CPP file of library I use #include "Arduino.h" Is it correct?
I'm missing something?

int mylibrary::_splitCount(String textToSplit, char separator)
{
  int count = 1;
  Serial.println("Test");
  
  int i = 0;
  while(i < textToSplit.length()) //OR for(int i = 0; i < textToSplit.length(; i++) same behavior !
  {
	Serial.print(i,DEC);
	Serial.print(" > ");
	Serial.println(textToSplit[i]);
    if(textToSplit[i] == separator)
      count++;
	  
	i++;
  }

  Serial.println("End test");
  return count;
}

Help! :fearful:

You've shown the implementation of one function in the library. You haven't shown the declaration of that function in the header file, or how you called that function.

Nor have you shown what the input is, or what the output is.

How can we help you solve the case, seeing only the first 10 minutes of the 2 hour whodunit?

Nor did you tells the type of arduino you are using. The Uno (for example) has 2k of ram. These processors are NOT von nuemann machines.

Mark

I use 8.226 bytes (max 32.256 bytes)

I think you are mixing up program memory and SRAM.

...R