1. Marcin Jurkowski
  2. PowerBuilder
  3. Wednesday, 16 June 2021 13:54 PM UTC

Hi,

Is there something in PowerScript equivalent to String.IsNullOrWhiteSpace in C# (String.IsNullOrWhiteSpace(String) Method (System) | Microsoft Docs).

I think it would be nice to have something like that as at the moment I have to use multiple "OR".
It's a very handy method so maybe it can be added to PB at some stage if it's not there.

P.S. Yes, I know that I can create my own method to do this same but it would be nice to have some new native functionality in the PowerScript from time to time).

Another thing would be some simple DateTime helpers like .Year, .Day, .Hour, etc...(available in C#)...something to make the programing faster and easier.

Regards,
Marcin

Accepted Answer
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 16 June 2021 14:21 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi Marcin,

Nope, there's no equivalent for IsNullOrWhitespace, but indeed it would be a nice to have. I think you can create a ticket to request new features or send an email to product@appeon.com.

What I'm doing, is create all dotnet functions that I want to use in a .Net DLL and then import that Dll as a non visual userobject, using the DLL Importer tool. You get the added advantage that lots of operations are faster when executed in C# anyway.

regards

Comment
  1. Marcin Jurkowski
  2. Thursday, 17 June 2021 11:56 AM UTC
That would be great Miguel if you can post some code sample on the CodeXchange page. I'm sure that other people will find it useful as well.

Regards,

Marcin
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 17 June 2021 12:11 PM UTC
I don't have time now to create anything on CodeXchange (which is a good idea), but I did attach a attachment sample app in the past on this page:

https://community.appeon.com/index.php/qna/q-a/use-c-for-replace-function?limitstart=0#reply-23043

It's compile with .net framework 4.5.1, as we still have customers with windows 2003 servers, believe it or not.

Let me know if you need any help with it.

regards
  1. Helpful
  1. Marcin Jurkowski
  2. Thursday, 17 June 2021 13:15 PM UTC
No problem, that's perfect. Thank you
  1. Helpful
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 17 June 2021 06:08 AM UTC
  2. PowerBuilder
  3. # 1

I do not know how IsNullOrWhitespace works in C#

But I think you could write it in PowerBuilder yourself.

Something like

- IsNull (as_string) or as_string = ""

- IsNull (as_string) or Trim (as_string) = ""

- IsNull (as_string) or Trim (as_string, TRUE) = ""

HTH,

René

Comment
  1. Marcin Jurkowski
  2. Thursday, 17 June 2021 07:59 AM UTC
Thanks Rene.

Yes, that's what I'm doing at the moment but I would be nice to have some PowerScript language updates from time to time to make our work faster & easier e.g. IsNullOrWhiteSpace(as_string)
  1. Helpful
  1. René Ullrich
  2. Thursday, 17 June 2021 09:43 AM UTC
Yes, I agree.
  1. Helpful
  1. Daryl Foster
  2. Friday, 18 June 2021 00:56 AM UTC
Thanks René, I've been using Powerbuilder for over 20 years and I didn't know about that second argument to the Trim function either.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.