博文

目前显示的是 九月, 2018的博文

链表

链表 class Node:     def __init__(self,initdata):         self.data = initdata         self.next = None     def getData(self):         return self.data     def getNext(self):         return self.next     def setData(self,newdata):         self.data = newdata     def setNext(self,newnext):         self.next = newnext 无序链表 class UnorderedList:          # init_head is last Node.      def __init__(self):         self.head = None              def isEmpty(self):         return self.head == None     def add(self,item):         temp = Node(item)         temp.setNext(self.head)         self.head = temp     def size(self):         current = self.head         count = 0         while current != None:             count = count + 1             current = current.getNext()         return count          def search(self,item):         current = self.head         found = False         while current != None and not found:             if current.getData()

String

# trim # Python string_ = string.strip() # Java String string_ = string.trim(); # PHP $ string_ = trim( $stirng ); # substring  # Python result = string[0:6] # 0/6 - Index # Java String sub = string.substring(0, 6); # 0/6 - Index # PHP $ string_ = substr( $string , 0, 6); # 0 - Start # 6 - Length # equals # Java Only boolean tf = string . equals ( "string" ); # Operation == <- HDD address equals # length # Python lenght = len( string ) # Java int i = string .lenght(); # PHP $ int = strlen($ string ); # split # Python array = string.split( "delimiter" ) # Java String[] array = string.split( "," ); # Parameter : Regex, limit # Can use Regex. # PHP $array = explode( "delimiter" , $string); # concat  # Java String string = string .concat(string_) ; String string = string + string_ ; # Python / PHP string = string + string_ $string = $string . $string_ ;