The left rotation string of the sword (42)

Source: Internet
Author: User
Title Description

In assembly language, there is a shift instruction called the cyclic left shift (ROL), now there is a simple task, is to use a string to simulate the operation of the command results. For a given character sequence s, you turn the output of the sequence to the left of the K-bit after it is moved. For example, the character sequence s= "Abcxyzdef", which requires the output loop to move left 3 bits after the result, i.e. "XYZDEFABC". Isn't it simple? OK, Fix it!

<span style= "color: #33cc00;" >public class Solution {public    string leftrotatestring (String str,int N) {        if (Str.trim (). Length () ==0) {            return str;        }        StringBuilder rol=new StringBuilder ();        Rol.append (str.substring (n));        Rol.append (str.substring (0,n));        return rol.tostring ();    }} </span>


The left rotation string of the sword (42)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.