how to read text from sd card, split string and integer?

i want read the sd card text file. In that text file contain name and age of different persons. i want to read that names and their respective age should store in variable.

txt file will be like this:

so on…

Please give some programming suggestion

thanks in advance…

I’d use a fixed structure to make it easy to pic a random ‘person number x’ (using seek())
That said:
The code below is NOT tested !!

#include <SPI.h>
#include <SD.h>

# define cs_pin_numer 4 // your cs-pin
File persons;

char Name[10];
byte Age, pos;
char ch;

void setup() {
  while (!Serial) ;
  SD.begin(cs_pin_numer); //assumes all OK, file structure is perfect
  persons ="your_file.txt");
  while (persons.available())
    // read chars to name until a colon is found
    ch =;
    if (ch == 10 or ch == 13) continue; // CR LF to be skipped
    Name[pos] = ch;
    if (ch != ':') {
    Name[pos] = '\0'; // mark 'end of this name'
    pos = 0; // just prepare for 'next' person
    // now age.. two chars !!! (must be altered if this is not true)
    Age = - '0';
    Age = Age * 10 + - '0';
    // print out Name and age
    // get next on row

void loop()