Printing a substring

I have a constant string defined as follows:

char* room_text[] = {
"Office.",
"Den....",
"MBath...",
"Evap...",
"Roof...",
"FirePl.",
"HVAC...",
"Utility",
"Gym....",
"W Bed..",
"E Bed..",
"Lab...",
"Air Fan" } ;

How do I print [to an LCD] a substring of seven characters from this character string? I could use a crowbar and concatenate seven bytes from this string into a new string, then print that, but I'm sure there is a more elegant way. Thanks.

I'm having a little difficulty understanding what you want to accomplish, so could you provide an example?

Maybe I'm misunderstanding, but this works:

void setup() {
  int i;
  // put your setup code here, to run once:
  Serial.begin(9600);
  
  char* room_text[] = {
  "Office.",
  "Den....",
  "MBath...",
  "Evap...",
  "Roof...",
  "FirePl.",
  "HVAC...",
  "Utility",
  "Gym....",
  "W Bed..",
  "E Bed..",
  "Lab...",
  "Air Fan" } ;

  for (i = 0; i < sizeof(room_text) / sizeof(room_text[0]); i++) {
    Serial.println(room_text[i]);
  }
}

void loop() {
  // put your main code here, to run repeatedly:

}

Just change the Serial object to your LCD object.

I have a constant string defined as follows:

That is NOT a constant string. It is an array of strings that are NOT constant.

PaulS, you hit it pretty close to the head. It is an array, but in this case it won't change. Can it be declared as a constant so that it doesn't take up RAM?

I didn't understand the array, so I was treating it as a long string and trying to cut a substring out of it.

The following code prints the 7 characters with no other manipulation required:

lcd.print(room_text[ (Unit_ID - 1) ]) ;

My other "discovery" is that I don't have to have constant length text phrases--the commas establish the array index.