所以我在这里有这个 HTML:
<div id="verify-purchase-modal" data-role="dialog">
<div data-role="header">
<h1>Buy Item</h1>
</div>
<div data-role="content">
<form action="/Catalog/ProcessPurchase" method="post"> <div></div>
<div class="catalog-modal-image">
<img src="http://t6ak.roblox.com/cd4fad953f57e86e537da262b3503e04" alt="General Badblox" />
</div>
<div>
Would you like to buy the <strong>"General Badblox"</strong> Package
from ROBLOX for
<span class="currency-robux">400</span>?
</div>
<div class="ui-grid-a no-margin-grid add-large-margin-top clear">
<div class="ui-block-a">
<input name="__RequestVerificationToken" type="hidden" value="9EZgfWvmFbfVWWSvuIhMrWWs6E2XmjONlejy5JJRYQh5KBbttyCtH/ve1KcPq1MbLYnj6ktT8SyGfFrWRYshUMLUI1mmthTs1KJNizlPG8T809is5Y0ZJYJyqaTCmnom2P6vVpmnZATlqsFtN4pVhd1QH94cZbLU2eszES4+QLeES2Cv" />
<input data-val="true" data-val-number="The field CurrencyType must be a number." data-val-required="The CurrencyType field is required." id="CurrencyType" name="CurrencyType" type="hidden" value="1" />
<input data-val="true" data-val-number="The field AssetID must be a number." data-val-required="The AssetID field is required." id="AssetID" name="AssetID" type="hidden" value="98755232" />
<input data-val="true" data-val-number="The field UserAssetOptionID must be a number." data-val-required="The UserAssetOptionID field is required." id="UserAssetOptionID" name="UserAssetOptionID" type="hidden" value="0" />
<input type="submit" value="Buy Now" data-theme="d" />
</div>
<div class="ui-block-b">
<a id="cancelPurchase" data-rel="back" data-role="button" data-theme="f">Cancel</a>
</div>
</div>
<div class="dialog-footnote">
Your balance after this transaction will be <span class="currency-robux">11,910</span>.
</div>
</form>
</div>
</div>
我用VB从一个网站上得到它。在写着“400?”的那一行。我想提取 400,所以我将所有 HTML 保存为字符串。我试图做简单的事情,只使用一个子字符串来获取它,但我不断收到 OOB(越界)错误。请记住,我正在尝试在 Visual Basic 中执行此操作。
Dim daHtml As String = WebBrowser1.Document.Body.OuterHtml
Msg(daHtml.Substring(daHtml.IndexOf("currency-robux"">"), daHtml.IndexOf("</span>?")))