我有一个很长的文本字符串,已经从sql表中隔离出来并变成了字符串;
Thank you for your request.
Please click the following link to reset your password:
http://localhost:5692/Public/LogonSetPassword.aspx?activationLinkId=603fa657-9460-4417-adc2-7bcad0416c3e
If clicking on the link does not work then please copy and paste it directly into your browser address bar
我现在正尝试仅取出URL并将其放入另一个字符串。我需要从“ http”获取它,并使用唯一ID后面的空格结束它。
我尝试过:
string activationUrl = sql.Substring(sql.IndexOf("http", sql.IndexOf(" ")));
但是它似乎不起作用。有人可以解释我哪里出问题了吗?谢谢。
应该是换行符,而不是空格。
string activationUrl = sql.Substring(sql.IndexOf("http", sql.IndexOf("\n")));