Logo

Programming-Idioms

History of Idiom 110 > diff from v72 to v73

Edit summary for version 73 by programming-idioms.org:
Restored version 71: No.

Version 72

2021-11-07, 03:51:24

Version 73

2021-11-07, 21:19:12

Idiom #110 Check if string is blank

Set the boolean blank to true if the string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set the boolean blank to true if the string s is empty, or null, or contains only whitespace ; false otherwise.

Code
 @PreAuthorize("@ss.hasPermi('system:code:edit')")
    @Log(title = "邀请码", businessType = BusinessType.UPDATE)
    @PutMapping
    @ApiOperation("修改邀请码")
    public AjaxResult edit(@RequestBody YsInviteCode ysInviteCode)
    {
        return toAjax(ysInviteCodeService.updateYsInviteCode(ysInviteCode));
    }
Code
boolean blank = s==null || s.trim().isEmpty();
Comments bubble
Use strip (Java 11) instead of trim for Unicode-awareness, or more simply use isBlank (Java 11)
Comments bubble
Use strip (Java 11) instead of trim for Unicode-awareness, or more simply use isBlank (Java 11)
Doc URL
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#trim()
Doc URL
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html#trim()
Demo URL
https://repl.it/@ProgIdioms/CheerfulAzureEnvironment
Demo URL
https://repl.it/@ProgIdioms/CheerfulAzureEnvironment