我在這裏使用Powershell - 字符串來格式化HTML主體,但獲取以下錯誤:格式化字符串時出錯:索引(從零開始)必須大於或等於零並小於參數列表的大小..用這裏字符串
Error formatting a string: Index (zero based) must be greater than or equal to zero and less than the size of the argument list..
的代碼如下:
$my_html = @"
<html>
<head></head>
<body>
<p>You have been invited to the following SharePoint site:</p><a href={0}>{1}</a>
<p>If you are not sure what your username is, please find it at</p>' + '<a href="https://outside.arup.com/default.aspx">here</a>
<p>Your username is {3}</p><p>Your password is: {4}</p>
<p>Please note that for any support queries, please contact your Arup site owner or Global IT (Applications).</p>
</body>
</html>
"@ -f $url, $siteTitle, $username, $password
所有參數進行初始化,只是標準的字符串。我錯過了什麼?
感謝
其實只是注意到了我的錯誤,參數佔位符應爲0,1,2,3! – dotnetdev
如果這只是一個錯字,請提供自我回答或刪除問題:) –