0
Bir dize almaya çalışıyorum ve dizedeki her değeri ondalık ASCII değerine dönüştürüyorum. İlk önce [] bayt tipine dize dönüştürdüm ve [] baytının her bir elemanını almak ve ondalık ASCII değerine dönüştürmek istiyorum.Bir [] bayt içeren dizeleri ondalık değerlere dönüştürme
myArray := []byte(password) // convert string into []byte type
NumArray := [len(password)]int // create second []int type to store the converted []byte elements
for i := 0; i < len(myArray); i++{
/* I need some help to convert each element in myArray into ASCII decimal value and then store it into
NumArray.
*/
fmt.Printf("%d\n", myArray[i]) //prints out what the converted values should be
fmt.Print(NumArray[i]) //prints out the stored converted value for comparison
}
Düzenleme: İşte benim kod dizesi parola olması gerekiyordu ve bu yüzden Böyle int
için byte
yayınlayabileceğim herhangi bir değer
Yani seni Bize ne yaptığını anlattı. Sahip olduğun bir soru var mı? –