Read contact from StringBuilder object
I want to Read contact i.e. int from StringBuilder object. it had pdf file. I am reading using itextsharp classes. it looks like PH NO 456456121
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Joginder BangerRank #360 · 7K reputationPosted Mar 30, 2016, 11:26 AM EDT
Ankur Ankit2 reputationPosted Apr 7, 2016, 8:12 AM EDT
http://stackoverflow.com/questions/4711134/itextsharp-text-extraction
Note that, I didn't try iTextSharp myself before, but I am getting the text from PDF files using PDFdocument features using leadtools.
If the problem is with getting the numeric text (numbers) from the original string, try this code:
/****************************************************/
StringBuilder sb = new StringBuilder();
sb.Append("PH NO 456456121");
int _lastspaceindex = sb.ToString().LastIndexOf(' ');
string numeric_str = sb.ToString().Substring(_lastspaceindex, sb.Length - _lastspaceindex).Trim();
Console.WriteLine(numeric_str);
/****************************************************/