c# - String Substring is not working - Error starting index can not be larger than the length -


enter image description here

enter image description here

the error keeps saying "startindex cannot larger length of string. parameter name: startindex"

intializedports[i] = int.parse(ports[i].tostring().substring(105, 106)); //i tried intializedports[i] = int.parse(ports[i].tostring().substring(105, 1)); //this works, gets first number in string 5 intializedports[i] = int.parse(ports[i].tostring().substring(0, 1)); 

//the string i'm trying substring, im trying number 7 @ end of ipaddress in string

5b5bfdfe-6eb1-4b10-80af-cf4d9f1010fe3fc8ffa1-c16b-4d7b-9e55-1e88dfe15277fasttrackvirussoftware192.168.6.17tcp/ipyesready8/4/2013 1:07:43 pm9/1/2013 1:07:43 pm 

it character before "tcp/ip"

string line = "5b5bfdfe-6eb1-4b10-80af-cf4d9f1010fe3fc8ffa1-c16b-4d7b-9e55-1e88dfe15277fasttrackvirussoftware192.168.6.17tcp/ipyesready8/4/2013 1:07:43 pm9/1/2013 1:07:43 pm"; var num = line.substring(line.indexof("tcp/ip") - 1, 1); 

Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -