Here you can find the source of deleteWhiteSpace(String s)
public static String deleteWhiteSpace(String s)
//package com.java2s; /**/* www . j a va 2 s .c o m*/ * Copyright (c) 2016-2020 Weibo, Inc. * All rights reserved. * * This software is the confidential and proprietary information of Weibo, * Inc. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into with Weibo. */ public class Main { public static String deleteWhiteSpace(String s) { StringBuilder r = new StringBuilder(); if (s != null) { for (int i = 0; i < s.length(); i++) { if (!Character.isWhitespace(s.codePointAt(i))) { r.append(s.charAt(i)); } } } return r.toString(); } }