Remove String Spaces

kata programming

مساله:

ساده ، فاصله ها را از رشته حذف کنید ، سپس رشته حاصل را برگردانید.


Description:

Simple, remove the spaces from the string, then return the resultant string.


class Kata {
    static String noSpace(final String x) {
        return x.replace(" ", "");
    }
}
class Kata {
    static String noSpace(final String x) {
        return x.replaceAll("\\s+","");
    }
}
function no_space(string $s): string {
  return str_replace(' ', '', $s);
}
function no_space(string $s): string {
  return preg_replace("/\s/", "", $s);
}

دیدگاهتان را بنویسید