这个问题困扰了我一个多月。 它是这样的: 我们有两个字符串列表
Dim List1 As New List(Of String) From {"a", "b", "c", "d"} ' and so on
Dim List2 As New List(Of String) From {"e", "f", "g", "h", "i", "j"} ' and so on
此时我们有24种可能的组合(List1与List2)
Dim allCombo As Integer = List1.Count * List2.Count
循环和存储所有可能的组合不是一种选择。 现在我可以应用什么样的数学计算,这样如果我想要组合数13,则用'e'返回'c';或者24与'j'是'd',依此类推。 我坚持这个,有人可以帮我吗? 提前谢谢!
答案 0 :(得分:1)
Function GetIndex(index As Integer) As String
Dim List1 As New List(Of String) From {"a", "b", "c", "d"}
Dim List2 As New List(Of String) From {"e", "f", "g", "h", "i", "j"}
Dim intIndex0 As Integer = index - 1 'convert to 0-based
Dim index1 As Integer = intIndex0 \ List2.Count 'integer division
Dim index2 As Integer = intIndex0 Mod List2.Count 'modulo (remainder)
Return List1(index1) & List2(index2)
End Function
答案 1 :(得分:0)
var myFeedback = feedback();
myFeedback().successMessages(function(success) {
console.log(success);
}).errorMessages(function(error) {
console.log(error);
}).infoMessages(function(info) {
console.log(info);
}).allMessages(function(response) {
console.log(response);
});