문자열이 영숫자인지 확인하고 싶지만 논리 앱에서 문제가 발생합니다.
어떤 아이디어? explode
Strings 와 같은 것이 존재 하더라도 그렇게 할 것 입니다. 문자열을 배열로 만들기 위해 할 수있는 일이 있습니까?
문서에 따르면 결합하려는 값으로 배열을 만들어야합니다.
union(createArray(1, 2, 3), createArray(1, 2, 10, 101))
그리고 다음 결과를 반환합니다. [1, 2, 3, 10, 101]
그러나 특정 문자열이 영숫자인지 확인하려는 경우 올바른 방법이 아닐 수 있습니다. Azure 함수를 만들고 워크 플로에서 호출하는 것을 선호합니다. 다음 Azure Function 코드가 트릭을 수행해야합니다.
using System;
using System.Text;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
[FunctionName("AlphaNumericFunction")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)]
HttpRequest req, ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
string content = req.Query["content"];
string requestBody = await new StreamReader(req.Body).ReadToEndAsync();
dynamic data = JsonConvert.DeserializeObject(requestBody);
content = content ?? data?.content;
if (string.IsNullOrWhiteSpace(content))
{
return new BadRequestObjectResult("Please pass the content on the query string or in the request body");
}
Regex rg = new Regex(@"/^\w+$/");
var isAlphaNumeric = rg.IsMatch(content);
return (ActionResult)new OkObjectResult($"{isAlphaNumeric}");
}
편집하다:
함수 앱을 만들 수없는 경우 다음 인라인 접근 방식을 사용할 수 있습니다.
추신 : 샘플의 정규식을 ^ \ w + $로 바꿉니다.
https://docs.microsoft.com/en-us/azure/logic-apps/logic-apps-add-run-inline-code
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다