countUntil with negated pre-defined predicate?

Steven Schveighoffer schveiguy at gmail.com
Sat May 2 18:35:26 UTC 2020


On 5/2/20 2:23 PM, Robert M. Münch wrote:
> This works:
> 
>      countUntil!(std.uni.isWhite)("hello world"))
> 
> How can I switch this to (not working);
> 
>      countUntil!(!std.uni.isWhite)("hello world"))
> 
> without having to write my own predicate?
> 
> Or is there an even better way to search for all "drawable unicode 
> characters"?
> 

Write your own predicate, it's not much different:

countUntil!(c => !std.uni.isWhite(c))("hello world")

-Steve


More information about the Digitalmars-d-learn mailing list