Have I found you Flightless bird Grounded Bleeding or lost you American mouth (SINGING) How come I end up where I started How come I end up where I went wrong Won't take my eyes off the ball again You reel me out then you cut the string How come I end up where I started How come I end up where I went wrong Won't take my eyes off the ball again First you reel me outand then you cut the string You used to be all right What happened?
VOA: standard.other
And if that's true is everything in the string, starting at the first element and removing the last element, a palindrome?
如果是相同的话,是不是字符串中的所有从第一个元素开始,并且删除最后一个元素后?
Otherwise I'm going to check to see is the first and last, there's that - 1 indexing, is the first and last element of the string the same?
是第一个还是最后一个,这就是这边-1的索引内容,这个字符串的第一个,和最后一个的内容是否相同呢?
It's just a chunk of characters back to back to back so this is storing at the very first location in the string what?
它只是一串紧邻的字母串,所以它把什么存储在,字符串的第一个地址下?
Okay. First question: What string technique is being used here?
好,第一个问题是,这里运用了什么弦技巧
First, I'm going to do a sanity check strlen so we've used string length, strlen, before.
首先,我先做一个检查,我们以前使用过字符串长度函数。
But I can also ask for parts of this. So I can, for example, say give me the first element of s1 string 1, s 1. Ah, that's exactly what we would have thought if this was represented as an ordered sequence of things.
然后返回一个长字符串,我也可以,取字符串的一部分,例如,我可以要求返回给我字符串,的第一个元素,啊,这证明我们之前,认为的它是一个有序的字符序列的想法。
Well, get string again is returning the address of the string the user typed in, D the address of the very first character like the letter D and storing that address in this variable s1.
好的,GetString返回的是,用户输入的字符串的地址,第一个字符的地址,比如字母,然后把这个地址存储在这个变量s1中。
So this is again another method, this is remove, takes two arguments ivys the first is ivys, Harvard the second is the string Harvard.
这儿我们又用到了另外一种方法,就是remove,它有两个参数,第一个是,第二个是字符串。
This was the special value that said to the computer string stops here and because you have that barrier given to you at the end of every string, just the most efficient way you can pass strings around is just by passing the address of their very first bytes, the location in RAM.
这是一个特殊的值,表示的是,字符串在这里结束,因为在每个字符串的末尾,都有那个关卡,这是一个最有效率的方式,你可以通过传递,字符串的第一个字节的地址来传递一个字符串,地址是在RAM中的。
应用推荐