小编Dan*_*Dan的帖子

修改多个字符串字段

我有以下代码:

  class SearchCriteria
  {
        public string Name { get; set; }
        public string Email { get; set; }
        public string Company { get; set; }
        // ... around 20 fields follow

        public void Trim()
        {
            if( ! String.IsNullOrEmpty( Name ) )
            {
                 Name = Name.Trim();
            }

            if( ! String.IsNullOrEmpty( Email ) )
            {
                Email = Email.Trim();
            }

            // ... repeat for all 20 fields in the class.
        }
   }
Run Code Online (Sandbox Code Playgroud)

我想编写一个能够正确修剪字段的函数,例如:

public void Trim()
{
    Trim( Name );
    Trim( Email ); …
Run Code Online (Sandbox Code Playgroud)

c#

13
推荐指数
2
解决办法
535
查看次数

如何在Delphi中实现决策矩阵

我必须在Delphi 7中实现一个决策矩阵.该函数是

CalcNewStatus(actionCode:string; reportType:string; currentStatus:string):string;

  • ActionCode可以具有值'A'和'N'
  • ReportType可以具有值'I'和'F'
  • CurrentStatus可以具有值'P','I','F'.

例如,在C#中我会使用字典.我怎么能在Delphi 7中做到这一点?

delphi algorithm dictionary boolean-logic delphi-7

0
推荐指数
1
解决办法
611
查看次数

标签 统计

algorithm ×1

boolean-logic ×1

c# ×1

delphi ×1

delphi-7 ×1

dictionary ×1