我有很多看起来像这样的字符串:
current affairs
Run Code Online (Sandbox Code Playgroud)
我想让字符串成为:
current affairs
Run Code Online (Sandbox Code Playgroud)
我尝试使用,Trim()但它不会做这个工作
这是我的 build.gradle:
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
repositories {
maven { url 'https://maven.fabric.io/public' }
google()
}
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
useLibrary 'org.apache.http.legacy'
defaultConfig {
multiDexEnabled true
minSdkVersion 16
targetSdkVersion 26
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
renderscriptTargetApi 22
renderscriptSupportModeEnabled true
}
buildTypes {
debug {
debuggable true
buildConfigField "boolean", "CRASH_LOGGING", "true"
applicationIdSuffix ".dev" …Run Code Online (Sandbox Code Playgroud) android gradle google-play-services android-studio android-gradle-plugin
在objective-c中有一个类将所有Ipod歌曲带到数组,我正在寻找可以连接到设备音乐库的android中的东西.
我使用此代码将mp3文件嵌入到html中:
<EMBED SRC="mp3 link" HEIGHT=60 WIDTH=300>];
Run Code Online (Sandbox Code Playgroud)
问题是浏览器下载文件而不是播放它,有什么方法可以在缓冲区或类似的东西中进行吗?
因为我希望用户不会等待.
我得到的NSData字节看起来像这样:
2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d2d2d2d 2d353731 35343039 37373139
34383437 34303832 30333533 30383232 380d0a43 6f6e7465 6e742d44 6973706f 73697469 6f6e3a20
666f726d 2d646174 613b206e 616d653d 2266696c 65223b20 66696c65 6e616d65
3d224265 61636820 426f7973 202d2047 6f6f6420 56696272 6174696f 6e732e6d
Run Code Online (Sandbox Code Playgroud)
我想将它转换为NSString,我试过这个方法,但它给了我一个字符串的零:
NSString* postInfo = [[NSString alloc] initWithBytes:[postDataChunk bytes] length:[postDataChunk length] encoding:NSUTF8StringEncoding];
Run Code Online (Sandbox Code Playgroud) 我的应用程序中有UiNavigationController.我希望只有一个屏幕可以旋转,所以我放入这个类:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
return YES;
}
-(BOOL)shouldAutorotate {
return YES;
}
-(NSInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)
但发生的问题是在ecery屏幕上应用程序旋转发生.我怎么能禁用它?
我尝试添加我的网格点击处理程序:
<Grid x:Name="LayoutRoot" Background="#FF1F1F1F" Tap="OnTap">........</Grid>
Run Code Online (Sandbox Code Playgroud)
在InitializeComponent();我得到这个:
A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll
Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 14 Position: 58]
{System.Windows.Markup.XamlParseException: Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 14 Position: 58]
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at *.NowPlayingPageControl.InitializeComponent()
at *.NowPlayingPageControl..ctor()}
Run Code Online (Sandbox Code Playgroud) 我有这门课AlphaKeyGroup:
public class AlphaKeyGroup<T> : List<T>
{
/// <summary>
/// The delegate that is used to get the key information.
/// </summary>
/// <param name="item">An object of type T</param>
/// <returns>The key value to use for this object</returns>
public delegate string GetKeyDelegate(T item);
/// <summary>
/// The Key of this group.
/// </summary>
public string Key { get; private set; }
/// <summary>
/// Public constructor.
/// </summary>
/// <param name="key">The key for this group.</param>
public AlphaKeyGroup(string key) …Run Code Online (Sandbox Code Playgroud) 我有这样ItemView的Marionette:
App.View.MovieListItem = Marionette.ItemView.extend({
tagName: 'li',
className: 'movie',
model: App.Model.Movie,
id: function() {
return 'movie-'+this.model.get('imdb')
},
initialize: function () {
this.render();
},
template: _.template('<a href="javascript:;">'+
'<i class="fa fa-eye fa-3"></i>'+
'<span class="cover"></span>'+
'<strong><%= title %></strong>'+
'<small><%- year %></small>'+
'<small2>Cached</small2>'+
'</a>'),
});
Run Code Online (Sandbox Code Playgroud)
我想知道是否可以动态创建模板?因为有些时候我想要(基于检查某些东西的方法)来删除small2标签.
我正在使用此代码从读取数据NSDictionary:
let itemsArray: NSArray = response.objectForKey("items") as! NSArray;
let nextPageToken: String = response.objectForKey("nextPageToken") as! String
var videoIdArray: [String] = []
for (item) in itemsArray {
let videoId: String? = item.valueForKey("id")!.valueForKey("videoId") as? String
videoIdArray.append(videoId!)
}
Run Code Online (Sandbox Code Playgroud)
但是,当我items还是nextPageToken不存在,我得到这个错误:
fatal error: unexpectedly found nil while unwrapping an Optional value
Run Code Online (Sandbox Code Playgroud)
知道为什么吗?我该如何解决?
c# ×3
iphone ×3
android ×2
html ×2
ios ×2
objective-c ×2
.net ×1
backbone.js ×1
gradle ×1
java ×1
javascript ×1
json ×1
marionette ×1
media ×1
nsdictionary ×1
silverlight ×1
swift ×1
wpf ×1
xcode ×1